diff --git a/action.yml b/action.yml index 4f3eff2..e9fa0b8 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,10 @@ inputs: - base: backport PR's base branch - number: original PR's number default: "backport-<%= number %>-to-<%= base %>" + team_reviews: + description: Whether to request reviews from the team. + required: false + default: "release" label_pattern: description: > The regular expression pattern that PR labels will be tested on to decide whether the PR should be backported and where. diff --git a/src/backport.ts b/src/backport.ts index 983d8ed..ebbda97 100644 --- a/src/backport.ts +++ b/src/backport.ts @@ -87,6 +87,7 @@ const backportOnce = async ({ merged_by, owner, repo, + teamReviews, title, }: Readonly<{ author: string; @@ -99,6 +100,7 @@ const backportOnce = async ({ merged_by: string; owner: string; repo: string; + teamReviews: string; title: string; }>): Promise => { const git = async (...args: string[]) => { @@ -135,7 +137,7 @@ const backportOnce = async ({ author !== merged_by && merged_by !== "" ? [author, merged_by] : [author], - team_reviewers: ["release"], + ...(teamReviews !== "" && { team_reviewers: [teamReviews] }) }, ); if (labels.length > 0) { @@ -243,6 +245,7 @@ const backport = async ({ payload, runId, serverUrl, + teamReviews, token, }: { getBody: ( @@ -270,6 +273,7 @@ const backport = async ({ payload: PullRequestClosedEvent | PullRequestLabeledEvent; runId: number; serverUrl: string; + teamReviews: string, token: string; }): Promise<{ [base: string]: number }> => { const { @@ -354,6 +358,7 @@ const backport = async ({ merged_by, owner, repo, + teamReviews, title, }); createdPullRequestBaseBranchToNumber[base] = backportPullRequestNumber; diff --git a/src/index.ts b/src/index.ts index 6c27614..a2e3090 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,6 +15,7 @@ const run = async () => { const labelPattern = getInput("label_pattern"); const labelRegExp = new RegExp(labelPattern); + const teamReviews = getInput("team_reviews"); const token = getInput("github_token", { required: true }); @@ -40,6 +41,7 @@ const run = async () => { payload, runId, serverUrl, + teamReviews, token, }); setOutput(