Fix event action check

This commit is contained in:
Nick Alteen
2025-09-16 13:00:00 -04:00
parent f44c11ebd1
commit 6b35c8253b
5 changed files with 6 additions and 6 deletions

View File

@@ -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'

View File

@@ -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
View File

@@ -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

File diff suppressed because one or more lines are too long

View File

@@ -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.