MCPcopy Create free account
hub / github.com/angular/dev-infra / run

Method run

github-actions/labeling/issue/lib/issue-labeling.ts:20–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18 private addedLabels: string[] = [];
19
20 async run() {
21 const {owner, repo, number} = context.issue;
22 core.info(`Processing ${this.type} #${number}...`);
23
24 if (!this.issueData) {
25 await this.initialize();
26 }
27
28 // 1. Run auto-labeler first (it safely skips if an area label is already present).
29 await this.runAutoLabeling();
30
31 // 2. Re-fetch the latest issue state to ensure we capture any newly added labels.
32 const updatedIssue = await this.git.issues.get({
33 owner,
34 repo,
35 issue_number: number,
36 });
37 const labels = updatedIssue.data.labels.map((l: string | {name?: string}) =>
38 typeof l === 'string' ? l : l.name || '',
39 );
40 // the API response may not immediately reflect the labels we just added,
41 // so we're adding the labels we've added during this run manually to ensure
42 // the milestone logic below works correctly.
43 labels.push(...this.addedLabels);
44
45 const hasAreaLabel = labels.some((l) => l.startsWith('area: '));
46 const hasPriorityLabel = labels.some((l) => /^P[0-5]$/.test(l));
47
48 if (hasPriorityLabel) {
49 await this.applyMilestoneIfFound(BACKLOG_MILESTONE);
50 } else if (hasAreaLabel) {
51 await this.applyMilestoneIfFound(NEEDS_TRIAGE_MILESTONE);
52 }
53 }
54
55 override async addLabel(label: string) {
56 await super.addLabel(label);

Callers 3

main.tsFile · 0.45
runFunction · 0.45

Calls 5

initializeMethod · 0.95
runAutoLabelingMethod · 0.95
applyMilestoneIfFoundMethod · 0.95
getMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected