Skip to content

Commit 548cf22

Browse files
authored
[autolabel][ez] Remove repo specific autolabel config (#7446)
The repo should use labeler.yml instead the pytorch/pytorch ones are getting moved in pytorch/pytorch#167330
1 parent e616cec commit 548cf22

File tree

3 files changed

+0
-87
lines changed

3 files changed

+0
-87
lines changed

torchci/lib/bot/autoLabelBot.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -140,27 +140,6 @@ const notUserFacingPatterns: RegExp[] = [
140140

141141
const notUserFacingPatternExceptions: RegExp[] = [/tools\/autograd/g];
142142

143-
// For in the specified repo, if any file path matches the given regex we will apply the label
144-
// corresponding to that file to the PR
145-
//
146-
// Format: "owner/repo": [
147-
// [/regex-for-path1/, "label-to-apply"],
148-
// [/regex-for-path2/, "label-to-apply"],
149-
// ]
150-
const repoSpecificAutoLabels: { [repo: string]: [RegExp, string][] } = {
151-
"pytorch/pytorch": [
152-
[/aten\/src\/ATen\/mps/gi, "ciflow/mps"],
153-
[/aten\/src\/ATen\/native\/mps/gi, "ciflow/mps"],
154-
[/torch\/_inductor\/codegen\/mps.py/gi, "ciflow/mps"],
155-
[/torch\/csrc\/distributed\/c10d\/symm_mem/gi, "ciflow/h100-symm-mem"],
156-
[/torch\/distributed\/_symmetric_memory/gi, "ciflow/h100-symm-mem"],
157-
[/test\/distributed\/.*mem.*/gi, "ciflow/h100-symm-mem"],
158-
[/test\/test_mps.py/gi, "ciflow/mps"],
159-
[/test\/inductor\/test_mps_basic.py/gi, "ciflow/mps"],
160-
],
161-
"pytorch/fake-test-repo": [[/somefolder/gi, "cool-label"]],
162-
};
163-
164143
export async function getLabelsFromLabelerConfig(
165144
context: Context,
166145
labelerConfigTracker: CachedLabelerConfigTracker,
@@ -208,30 +187,6 @@ export async function getLabelsFromLabelToLabelConfig(
208187
return newLabels;
209188
}
210189

211-
function getRepoSpecificLabels(
212-
owner: string,
213-
repo: string,
214-
changedFiles: string[]
215-
): string[] {
216-
var repoKey = owner + "/" + repo;
217-
if (!repoSpecificAutoLabels.hasOwnProperty(repoKey)) {
218-
return [];
219-
}
220-
221-
const config = repoSpecificAutoLabels[repoKey];
222-
223-
const labelsToAdd: string[] = [];
224-
for (const file of changedFiles) {
225-
// check for typical matches
226-
for (const [regex, label] of config) {
227-
if (file.match(regex)) {
228-
labelsToAdd.push(label);
229-
}
230-
}
231-
}
232-
return labelsToAdd;
233-
}
234-
235190
function TDRolloutIssueParser(rawSubsText: string): object {
236191
const subsText = rawSubsText.replace("\r", "");
237192
const subsRows = subsText.match(/^\*.+/gm);
@@ -532,10 +487,6 @@ function myBot(app: Probot): void {
532487
}
533488
}
534489

535-
// Add a repo specific labels (if any)
536-
var repoSpecificLabels = getRepoSpecificLabels(owner, repo, filesChanged);
537-
labelsToAdd.push(...repoSpecificLabels);
538-
539490
var labelsFromLabelerConfig = await getLabelsFromLabelerConfig(
540491
context,
541492
labelerConfigTracker,

torchci/test/autoCcBot.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Probot } from "probot";
44
import myProbotApp from "../lib/bot/autoCcBot";
55
import { nockTracker } from "./common";
66
import * as utils from "./utils";
7-
87
nock.disableNetConnect();
98

109
describe("auto-cc-bot", () => {

torchci/test/autoLabelBot.test.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -450,43 +450,6 @@ describe("auto-label-bot", () => {
450450
scope.done();
451451
});
452452

453-
test("custom repo labels get add when on a matching repo and file", async () => {
454-
nock("https://api.github.com")
455-
.post("/app/installations/2/access_tokens")
456-
.reply(200, { token: "test" });
457-
emptyMockConfig("pytorch/fake-test-repo");
458-
utils.mockHasApprovedWorkflowRun("pytorch/fake-test-repo");
459-
460-
const payload = requireDeepCopy("./fixtures/pull_request.opened")[
461-
"payload"
462-
];
463-
payload["pull_request"]["title"] = "modify a pytorch/fake-test-repo file";
464-
payload["pull_request"]["labels"] = [];
465-
payload["repository"]["owner"]["login"] = "pytorch";
466-
payload["repository"]["name"] = "fake-test-repo";
467-
const prFiles = requireDeepCopy("./fixtures/pull_files");
468-
prFiles["items"] = [
469-
{ filename: "somefolder/a.py" },
470-
{ filename: "otherfolder/b.py" },
471-
];
472-
473-
const scope = nock("https://api.github.com")
474-
.get("/repos/pytorch/fake-test-repo/pulls/31/files?per_page=100")
475-
.reply(200, prFiles, {
476-
Link: "<https://api.github.com/repos/pytorch/fake-test-repo/pulls/31/files?per_page=100&page=1>; rel='last'",
477-
"X-GitHub-Media-Type": "github.v3; format=json",
478-
})
479-
.post("/repos/pytorch/fake-test-repo/issues/31/labels", (body) => {
480-
expect(body).toMatchObject({ labels: ["cool-label"] });
481-
return true;
482-
})
483-
.reply(200);
484-
485-
await probot.receive({ name: "pull_request", payload: payload, id: "2" });
486-
487-
scope.done();
488-
});
489-
490453
test("caffe2 files trigger caffe2 label", async () => {
491454
nock("https://api.github.com")
492455
.post("/app/installations/2/access_tokens")

0 commit comments

Comments
 (0)