Fix event action check
This commit is contained in:
@@ -8,6 +8,7 @@ export const context = {
|
||||
number: 10
|
||||
},
|
||||
payload: {
|
||||
action: 'opened',
|
||||
number: 10,
|
||||
issue: {
|
||||
number: 10
|
||||
@@ -19,7 +20,6 @@ export const context = {
|
||||
login: 'mona'
|
||||
}
|
||||
},
|
||||
action: 'opened',
|
||||
repo: {
|
||||
owner: 'actions',
|
||||
repo: 'first-interaction'
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('main.ts', () => {
|
||||
beforeEach(() => {
|
||||
// "Reset" the github context.
|
||||
github.context.eventName = 'pull_request'
|
||||
github.context.action = 'opened'
|
||||
github.context.payload.action = 'opened'
|
||||
github.context.payload.issue = undefined as any
|
||||
github.context.payload.pull_request = {
|
||||
number: 10
|
||||
@@ -57,7 +57,7 @@ describe('main.ts', () => {
|
||||
})
|
||||
|
||||
it('Skips invalid actions', async () => {
|
||||
github.context.action = 'edited'
|
||||
github.context.payload.action = 'edited'
|
||||
|
||||
await main.run()
|
||||
|
||||
|
||||
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
@@ -34832,7 +34832,7 @@ async function run() {
|
||||
if (!isIssue && !isPullRequest)
|
||||
return coreExports.info('Skipping...Not an Issue/PR Event');
|
||||
// Skip if this is not an issue/PR open event.
|
||||
if (githubExports.context.action !== 'opened')
|
||||
if (githubExports.context.payload.action !== 'opened')
|
||||
return coreExports.info('Skipping...Not an Opened Event');
|
||||
// Confirm the sender data is present.
|
||||
if (!githubExports.context.payload.sender)
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -14,7 +14,7 @@ export async function run() {
|
||||
return core.info('Skipping...Not an Issue/PR Event')
|
||||
|
||||
// Skip if this is not an issue/PR open event.
|
||||
if (github.context.action !== 'opened')
|
||||
if (github.context.payload.action !== 'opened')
|
||||
return core.info('Skipping...Not an Opened Event')
|
||||
|
||||
// Confirm the sender data is present.
|
||||
|
||||
Reference in New Issue
Block a user