Merge pull request #354 from actions/ncalteen/event

Fix event action check
This commit is contained in:
Nick Alteen
2025-09-22 14:37:11 -04:00
committed by GitHub
5 changed files with 6 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ export const context = {
number: 10 number: 10
}, },
payload: { payload: {
action: 'opened',
number: 10, number: 10,
issue: { issue: {
number: 10 number: 10
@@ -19,7 +20,6 @@ export const context = {
login: 'mona' login: 'mona'
} }
}, },
action: 'opened',
repo: { repo: {
owner: 'actions', owner: 'actions',
repo: 'first-interaction' repo: 'first-interaction'

View File

@@ -30,7 +30,7 @@ describe('main.ts', () => {
beforeEach(() => { beforeEach(() => {
// "Reset" the github context. // "Reset" the github context.
github.context.eventName = 'pull_request' github.context.eventName = 'pull_request'
github.context.action = 'opened' github.context.payload.action = 'opened'
github.context.payload.issue = undefined as any github.context.payload.issue = undefined as any
github.context.payload.pull_request = { github.context.payload.pull_request = {
number: 10 number: 10
@@ -57,7 +57,7 @@ describe('main.ts', () => {
}) })
it('Skips invalid actions', async () => { it('Skips invalid actions', async () => {
github.context.action = 'edited' github.context.payload.action = 'edited'
await main.run() await main.run()

2
dist/index.js generated vendored
View File

@@ -34832,7 +34832,7 @@ async function run() {
if (!isIssue && !isPullRequest) if (!isIssue && !isPullRequest)
return coreExports.info('Skipping...Not an Issue/PR Event'); return coreExports.info('Skipping...Not an Issue/PR Event');
// Skip if this is not an issue/PR open 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'); return coreExports.info('Skipping...Not an Opened Event');
// Confirm the sender data is present. // Confirm the sender data is present.
if (!githubExports.context.payload.sender) 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') return core.info('Skipping...Not an Issue/PR Event')
// Skip if this is not an issue/PR open 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') return core.info('Skipping...Not an Opened Event')
// Confirm the sender data is present. // Confirm the sender data is present.