Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable auto request reviewers feature #240

Merged
merged 2 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

40 changes: 1 addition & 39 deletions src/backport.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import * as core from "@actions/core";
import dedent from "dedent";

import {
CreatePullRequestResponse,
RequestReviewersResponse,
PullRequest,
} from "./github";
import { CreatePullRequestResponse, PullRequest } from "./github";
import { GithubApi } from "./github";
import * as git from "./git";
import * as utils from "./utils";
Expand Down Expand Up @@ -56,7 +52,6 @@ export class Backport {
const headref = mainpr.head.sha;
const baseref = mainpr.base.sha;
const labels = mainpr.labels;
const reviewers = mainpr.requested_reviewers?.map((r) => r.login) ?? [];

console.log(
`Detected labels on PR: ${labels.map((label) => label.name)}`
Expand Down Expand Up @@ -171,27 +166,6 @@ export class Backport {
}
const new_pr = new_pr_response.data;

const review_response = await this.github.requestReviewers({
owner,
repo,
pull_number: new_pr.number,
reviewers,
});
if (review_response.status != 201) {
console.error(JSON.stringify(review_response));
const message = this.composeMessageForRequestReviewersFailed(
review_response,
target
);
await this.github.createComment({
owner,
repo,
issue_number: pull_number,
body: message,
});
continue;
}

const message = this.composeMessageForSuccess(new_pr.number, target);
await this.github.createComment({
owner,
Expand Down Expand Up @@ -285,18 +259,6 @@ export class Backport {
(see action log for full response)`;
}

private composeMessageForRequestReviewersFailed(
response: RequestReviewersResponse,
target: string
): string {
return dedent`${this.composeMessageForSuccess(response.data.number, target)}
But, request reviewers was rejected with status ${
response.status
}.

(see action log for full response)`;
}

private composeMessageForSuccess(pr_number: number, target: string) {
return dedent`Successfully created backport PR #${pr_number} for \`${target}\`.`;
}
Expand Down
10 changes: 1 addition & 9 deletions src/test/backport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe("the backport action", () => {
config.pwd
);
});
it("creates a pull request and requests reviewers", async () => {
it("creates a pull request", async () => {
mockedGit.push.mockResolvedValue(0);
await backport.run();
expect(
Expand All @@ -124,14 +124,6 @@ describe("the backport action", () => {
body: `Backport of #1347 to \`stable/0.25\`.`,
maintainer_can_modify: true,
});
expect(
mockedDefaultGithubWithBackportLabel.requestReviewers
).toHaveBeenCalledWith({
owner: "octocat",
repo: "Hello-World",
pull_number: 9000,
reviewers: ["other_user"],
});
});
});
});
Expand Down