Skip to content

Commit 5411696

Browse files
authored
[summarize-impact] do not read any labels (#37895)
- summarize-impact only triggers on PR code changes, not label changes, so it cannot depend on the state of any labels at the time it runs - fixes #37876
1 parent 7a89211 commit 5411696

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

eng/tools/summarize-impact/src/cli.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,13 @@ export async function main() {
9393
...(process.env.GITHUB_TOKEN && { auth: process.env.GITHUB_TOKEN }),
9494
});
9595

96-
const labels = (
97-
await github.paginate(github.rest.issues.listLabelsOnIssue, {
98-
owner,
99-
repo,
100-
issue_number: Number(prNumber),
101-
per_page: 100,
102-
})
103-
).map((label: any) => label.name);
104-
10596
// this is a request to get the list of RPaaS folders from azure-rest-api-specs -> main branch -> dump specification folder names
10697
const mainSpecFolders = await getRPaaSFolderList(github, owner, repo);
10798

10899
const labelContext: LabelContext = {
109-
present: new Set(labels),
100+
// summarize-impact only triggers on PR code changes, not label changes. Since this code cannot depend
101+
// on the state of any labels at the time it runs, initialize the "present" set of labels to empty.
102+
present: new Set(),
110103
toAdd: new Set(),
111104
toRemove: new Set(),
112105
};

eng/tools/summarize-impact/src/impact.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export const getResourceProviderFromFilePath = (filePath: string): string | unde
238238

239239
async function processTypeSpec(ctx: PRContext, labelContext: LabelContext): Promise<boolean> {
240240
console.log("ENTER definition processTypeSpec");
241-
const typeSpecLabel = new Label("TypeSpec", labelContext.present);
241+
const typeSpecLabel = new Label("TypeSpec");
242242
// By default this label should not be present. We may determine later in this function that it should be present after all.
243243
typeSpecLabel.shouldBePresent = false;
244244
const handlers: ChangeHandler[] = [];
@@ -421,7 +421,7 @@ function processPRTypeLabel(
421421
types: PRType[],
422422
labelContext: LabelContext,
423423
): boolean {
424-
const label = new Label(labelName, labelContext.present);
424+
const label = new Label(labelName);
425425
label.shouldBePresent = types.includes(labelName);
426426

427427
label.applyStateChange(labelContext.toAdd, labelContext.toRemove);
@@ -431,10 +431,7 @@ function processPRTypeLabel(
431431
async function processSuppression(context: PRContext, labelContext: LabelContext) {
432432
console.log("ENTER definition processSuppression");
433433

434-
const suppressionReviewRequiredLabel = new Label(
435-
"SuppressionReviewRequired",
436-
labelContext.present,
437-
);
434+
const suppressionReviewRequiredLabel = new Label("SuppressionReviewRequired");
438435
// By default this label should not be present. We may determine later in this function that it should be present after all.
439436
suppressionReviewRequiredLabel.shouldBePresent = false;
440437
const handlers: ChangeHandler[] = [];
@@ -536,7 +533,7 @@ async function processRPaaS(
536533
labelContext: LabelContext,
537534
): Promise<{ rpaasLabelShouldBePresent: boolean }> {
538535
console.log("ENTER definition processRPaaS");
539-
const rpaasLabel = new Label("RPaaS", labelContext.present);
536+
const rpaasLabel = new Label("RPaaS");
540537
// By default this label should not be present. We may determine later in this function that it should be present after all.
541538
rpaasLabel.shouldBePresent = false;
542539

@@ -572,7 +569,7 @@ async function processNewRPNamespace(
572569
resourceManagerLabelShouldBePresent: boolean,
573570
): Promise<{ newRPNamespaceLabelShouldBePresent: boolean }> {
574571
console.log("ENTER definition processNewRPNamespace");
575-
const newRPNamespaceLabel = new Label("new-rp-namespace", labelContext.present);
572+
const newRPNamespaceLabel = new Label("new-rp-namespace");
576573
// By default this label should not be present. We may determine later in this function that it should be present after all.
577574
newRPNamespaceLabel.shouldBePresent = false;
578575
const handlers: ChangeHandler[] = [];
@@ -627,10 +624,7 @@ async function processNewRpNamespaceWithoutRpaasLabel(
627624
rpaasLabelShouldBePresent: boolean,
628625
): Promise<boolean> {
629626
console.log("ENTER definition processNewRpNamespaceWithoutRpaasLabel");
630-
const ciNewRPNamespaceWithoutRpaaSLabel = new Label(
631-
"CI-NewRPNamespaceWithoutRPaaS",
632-
labelContext.present,
633-
);
627+
const ciNewRPNamespaceWithoutRpaaSLabel = new Label("CI-NewRPNamespaceWithoutRPaaS");
634628
// By default this label should not be present. We may determine later in this function that it should be present after all.
635629
ciNewRPNamespaceWithoutRpaaSLabel.shouldBePresent = false;
636630

@@ -724,10 +718,7 @@ async function processRpaasRpNotInPrivateRepoLabel(
724718
rpFolderNames: string[],
725719
): Promise<{ ciRpaasRPNotInPrivateRepoLabelShouldBePresent: boolean }> {
726720
console.log("ENTER definition processRpaasRpNotInPrivateRepoLabel");
727-
const ciRpaasRPNotInPrivateRepoLabel = new Label(
728-
"CI-RpaaSRPNotInPrivateRepo",
729-
labelContext.present,
730-
);
721+
const ciRpaasRPNotInPrivateRepoLabel = new Label("CI-RpaaSRPNotInPrivateRepo");
731722
// By default this label should not be present. We may determine later in this function that it should be present after all.
732723
ciRpaasRPNotInPrivateRepoLabel.shouldBePresent = false;
733724

eng/tools/summarize-impact/src/labelling-types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ export class Label {
5555
*/
5656
shouldBePresent: boolean | undefined = undefined;
5757

58-
constructor(name: string, presentLabels?: Set<string>) {
58+
constructor(name: string) {
5959
this.name = name;
60-
this.present = presentLabels?.has(this.name) ?? undefined;
6160
}
6261

6362
/**

0 commit comments

Comments
 (0)