From a9175f39863d11d5f881d151a1010b571e3b921d Mon Sep 17 00:00:00 2001 From: Thomas Boop <52323235+thboop@users.noreply.github.com> Date: Tue, 21 Jan 2020 10:44:38 -0500 Subject: [PATCH] Correctly pull issue number for pull request review events (#311) --- packages/github/__tests__/lib.test.ts | 5 +++-- packages/github/src/context.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/github/__tests__/lib.test.ts b/packages/github/__tests__/lib.test.ts index 5c042f2a..dae2a8cd 100644 --- a/packages/github/__tests__/lib.test.ts +++ b/packages/github/__tests__/lib.test.ts @@ -52,10 +52,11 @@ describe('@actions/context', () => { }) }) - it('works with pullRequest payloads', () => { + it('works with pull_request payloads', () => { delete process.env.GITHUB_REPOSITORY context.payload = { - pullRequest: {number: 2}, + // eslint-disable-next-line @typescript-eslint/camelcase + pull_request: {number: 2}, repository: {owner: {login: 'user'}, name: 'test'} } expect(context.issue).toEqual({ diff --git a/packages/github/src/context.ts b/packages/github/src/context.ts index f2aafde1..21f14c9c 100644 --- a/packages/github/src/context.ts +++ b/packages/github/src/context.ts @@ -44,7 +44,7 @@ export class Context { return { ...this.repo, - number: (payload.issue || payload.pullRequest || payload).number + number: (payload.issue || payload.pull_request || payload).number } }