Skip to content

Commit

Permalink
Merge pull request #240 from zeebe-io/239-disable-request-reviewers
Browse files Browse the repository at this point in the history
Disable auto request reviewers feature
  • Loading branch information
korthout authored May 23, 2022
2 parents bc78cfb + 93a5c52 commit fcd8f6a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 74 deletions.
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

0 comments on commit fcd8f6a

Please sign in to comment.