diff --git a/source/dsl/GitHubDSL.ts b/source/dsl/GitHubDSL.ts index c4deff04a..10e562dc3 100644 --- a/source/dsl/GitHubDSL.ts +++ b/source/dsl/GitHubDSL.ts @@ -289,13 +289,13 @@ export interface GitHubPRDSL { /** How does the PR author relate to this repo/org? */ author_association: - | "COLLABORATOR" - | "CONTRIBUTOR" - | "FIRST_TIMER" - | "FIRST_TIME_CONTRIBUTOR" - | "MEMBER" - | "NONE" - | "OWNER" + | "COLLABORATOR" + | "CONTRIBUTOR" + | "FIRST_TIMER" + | "FIRST_TIME_CONTRIBUTOR" + | "MEMBER" + | "NONE" + | "OWNER" } // These are the individual subtypes of objects inside the larger DSL objects above. @@ -462,8 +462,13 @@ export interface GitHubAPIPR { owner: string /** The repo name */ repo: string - /** The PR number */ + /** + * The PR number + * @deprecated use `pull_number` instead + */ number: number + /** The PR number */ + pull_number: number } export interface GitHubReviewers { diff --git a/source/platforms/GitHub.ts b/source/platforms/GitHub.ts index d1a7fab46..31e651fad 100644 --- a/source/platforms/GitHub.ts +++ b/source/platforms/GitHub.ts @@ -20,6 +20,7 @@ export function GitHub(api: GitHubAPI) { const APIMetadataForPR = (pr: GitHubPRDSL): GitHubAPIPR => { return { number: pr.number, + pull_number: pr.number, repo: pr.base.repo.name, owner: pr.base.repo.owner.login, } diff --git a/source/platforms/_tests/_github.test.ts b/source/platforms/_tests/_github.test.ts index 72a576929..3f14ad893 100644 --- a/source/platforms/_tests/_github.test.ts +++ b/source/platforms/_tests/_github.test.ts @@ -7,8 +7,8 @@ const fixtures = resolve(__dirname, "fixtures") // eslint-disable-next-line jest/no-export export const requestWithFixturedJSON = async (path: string): Promise<() => Promise> => - () => - Promise.resolve(JSON.parse(readFileSync(`${fixtures}/${path}`, {}).toString())) + () => + Promise.resolve(JSON.parse(readFileSync(`${fixtures}/${path}`, {}).toString())) class mockGitHubAPI { async getPullRequestInfo() { @@ -103,6 +103,7 @@ describe("getPlatformReviewDSLRepresentation", () => { const dsl = await github.getPlatformReviewDSLRepresentation() expect(dsl.thisPR).toEqual({ + pull_number: 327, number: 327, owner: "artsy", repo: "emission",