Skip to content

Commit

Permalink
fix: copy requested reviewers not reviewers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
korthout committed Nov 5, 2023
1 parent fe78391 commit 45f65af
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
7 changes: 4 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand Down
4 changes: 2 additions & 2 deletions src/backport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type Config = {
};
copy_milestone: boolean;
copy_assignees: boolean;
copy_reviewers: boolean;
copy_requested_reviewers: boolean;
};

enum Output {
Expand Down Expand Up @@ -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,
);
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function run(): Promise<void> {
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}'`;
Expand All @@ -41,7 +41,7 @@ async function run(): Promise<void> {
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);

Expand Down

0 comments on commit 45f65af

Please sign in to comment.