Skip to content

Commit c955488

Browse files
authored
[Bot] Don't remove module: labels from PRs (#7471)
As they are used in conjunction with CC bot and there are number of `autolabeller` configs that adds `module:` labels see https://github.com/pytorch/pytorch/blob/0cd0bd7217fc298e7470cc7d138994cd44f59256/.github/labeler.yml#L7 for example
1 parent f914f28 commit c955488

2 files changed

Lines changed: 1 addition & 26 deletions

File tree

torchci/lib/bot/autoLabelBot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ function myBot(app: Probot): void {
576576
context.log({ addedLabel });
577577

578578
// Remove issue-only labels from PRs
579-
if (addedLabel.startsWith("module:") || addedLabel.startsWith("oncall:")) {
579+
if (addedLabel.startsWith("oncall:")) {
580580
context.log(
581581
`Removing issue-only label "${addedLabel}" from PR ${context.payload.pull_request.html_url}`
582582
);

torchci/test/autoLabelBot.test.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,31 +1363,6 @@ describe("auto-label-bot: label restrictions", () => {
13631363
handleScope(scope);
13641364
});
13651365

1366-
test("remove module label from pull request", async () => {
1367-
nock("https://api.github.com")
1368-
.post("/app/installations/2/access_tokens")
1369-
.reply(200, { token: "test" });
1370-
1371-
const payload = requireDeepCopy("./fixtures/pull_request.labeled");
1372-
payload["label"] = { name: "module: ci" };
1373-
payload["pull_request"]["labels"] = [{ name: "module: ci" }];
1374-
emptyMockConfig(payload.repository.full_name);
1375-
1376-
const scope = nock("https://api.github.com")
1377-
.delete("/repos/seemethere/test-repo/issues/20/labels/module%3A%20ci")
1378-
.reply(200)
1379-
.post("/repos/seemethere/test-repo/issues/20/comments", (body) => {
1380-
expect(body.body).toContain("module: ci");
1381-
expect(body.body).toContain("only applicable to issues");
1382-
return true;
1383-
})
1384-
.reply(200);
1385-
1386-
await probot.receive({ name: "pull_request", payload, id: "2" });
1387-
1388-
handleScope(scope);
1389-
});
1390-
13911366
test("remove oncall label from pull request", async () => {
13921367
nock("https://api.github.com")
13931368
.post("/app/installations/2/access_tokens")

0 commit comments

Comments
 (0)