From 45f65af739fd8b3088300ab38f481063830f969c Mon Sep 17 00:00:00 2001 From: Nico Korthout Date: Sun, 5 Nov 2023 13:59:56 +0100 Subject: [PATCH] fix: copy requested reviewers not reviewers The current implementation is not aligned with this description. It copies the currently open review requests and does not request reviews from those that already reviewed the original pull request. Let's adjust the name and the description to fit what it does: copy the requested reviewers not the actual reviewers. --- README.md | 7 ++++--- action.yml | 7 ++++--- src/backport.ts | 4 ++-- src/main.ts | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ff56f3c..65891be 100644 --- a/README.md +++ b/README.md @@ -127,12 +127,13 @@ Default: `false` (disabled) Controls whether to copy the milestone from the original pull request to the backport pull request. By default, the milestone is not copied. -### `copy_reviewers` +### `copy_requested_reviewers` Default: `false` (disabled) -Controls whether to copy the reviewers from the original pull request to the backport pull request. -By default, the reviewers are not copied. +Controls whether to copy the requested reviewers from the original pull request to the backport pull request. +Note that this does not request reviews from those users who already reviewed the original pull request. +By default, the requested reviewers are not copied. ### `github_token` diff --git a/action.yml b/action.yml index 18f46a8..8690342 100644 --- a/action.yml +++ b/action.yml @@ -18,10 +18,11 @@ inputs: Controls whether to copy the milestone from the original pull request to the backport pull request. By default, the milestone is not copied. default: false - copy_reviewers: + copy_requested_reviewers: description: > - Controls whether to copy the reviewers from the original pull request to the backport pull request. - By default, the reviewers are not copied. + Controls whether to copy the requested reviewers from the original pull request to the backport pull request. + Note that this does not request reviews from those users who already reviewed the original pull request. + By default, the requested reviewers are not copied. default: false github_token: description: > diff --git a/src/backport.ts b/src/backport.ts index 9a227cf..67a8839 100644 --- a/src/backport.ts +++ b/src/backport.ts @@ -27,7 +27,7 @@ export type Config = { }; copy_milestone: boolean; copy_assignees: boolean; - copy_reviewers: boolean; + copy_requested_reviewers: boolean; }; enum Output { @@ -289,7 +289,7 @@ export class Backport { } } - if (this.config.copy_reviewers == true) { + if (this.config.copy_requested_reviewers == true) { const reviewers = mainpr.requested_reviewers?.map( (reviewer) => reviewer.login, ); diff --git a/src/main.ts b/src/main.ts index 2fcf8d7..618f51d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -20,7 +20,7 @@ async function run(): Promise { const merge_commits = core.getInput("merge_commits"); const copy_assignees = core.getInput("copy_assignees"); const copy_milestone = core.getInput("copy_milestone"); - const copy_reviewers = core.getInput("copy_reviewers"); + const copy_requested_reviewers = core.getInput("copy_requested_reviewers"); if (merge_commits != "fail" && merge_commits != "skip") { const message = `Expected input 'merge_commits' to be either 'fail' or 'skip', but was '${merge_commits}'`; @@ -41,7 +41,7 @@ async function run(): Promise { commits: { merge_commits }, copy_assignees: copy_assignees === "true", copy_milestone: copy_milestone === "true", - copy_reviewers: copy_reviewers === "true", + copy_requested_reviewers: copy_requested_reviewers === "true", }; const backport = new Backport(github, config, git);