Skip to content

Commit da320a7

Browse files
authored
Fix autoCC bot for pull request (#917)
Looks like GH changed REST API for updating pull request, not it should look as follows: https://docs.github.com/en/rest/pulls/pulls#update-a-pull-request
1 parent 3d88053 commit da320a7

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

torchci/lib/bot/autoCcBot.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ function myBot(app: Probot): void {
8181
if (payloadType === "issue") {
8282
await context.octokit.issues.update(context.issue({ body: newBody }));
8383
} else if (payloadType === "pull_request") {
84-
// @ts-ignore
85-
await context.octokit.pulls.update(context.issue({ body: newBody }));
84+
await context.octokit.pulls.update(context.pullRequest({ body: newBody }));
8685
}
8786
} else {
8887
context.log("no action: no change from existing cc list on issue");

torchci/test/autoCcBot.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,8 @@ Some header text
115115
payload["pull_request"]["body"] = "Arf arf";
116116

117117
const scope = nock("https://api.github.com")
118-
.patch("/repos/seemethere/test-repo/pulls/", (body: any) => {
118+
.patch("/repos/seemethere/test-repo/pulls/20", (body: any) => {
119119
expect(body).toMatchObject({
120-
issue_number: 20,
121120
body: "Arf arf\n\ncc @ezyang",
122121
});
123122
return true;

0 commit comments

Comments
 (0)