Skip to content

Commit 10ec958

Browse files
committed
ci: label workflow health incidents
1 parent 1798f6e commit 10ec958

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/ci-workflow-health.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
`<!-- cuda-python-ci-health:${run.workflow_id}:${scopeKey} -->`;
7575
const eventMarker =
7676
`<!-- cuda-python-ci-health-event:${run.id}:${run.run_attempt} -->`;
77+
const incidentLabel = "ci-workflow-health";
7778
const title = `[CI failure] ${run.name} ${scopeLabel}`;
7879
const repositoryUrl =
7980
`${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}`;
@@ -154,6 +155,19 @@ jobs:
154155
);
155156
}
156157
158+
for (const incident of incidents) {
159+
const hasIncidentLabel = incident.labels.some((label) =>
160+
(typeof label === "string" ? label : label.name) === incidentLabel,
161+
);
162+
if (!hasIncidentLabel) {
163+
await github.rest.issues.addLabels({
164+
...context.repo,
165+
issue_number: incident.number,
166+
labels: [incidentLabel],
167+
});
168+
}
169+
}
170+
157171
async function eventAlreadyRecorded(issue) {
158172
if (issue.body.includes(eventMarker)) {
159173
return true;
@@ -207,7 +221,7 @@ jobs:
207221
await github.rest.issues.create({
208222
...context.repo,
209223
title,
210-
labels: ["bug", "CI/CD", "triage"],
224+
labels: ["bug", "CI/CD", "triage", incidentLabel],
211225
body: [
212226
trackerMarker,
213227
eventMarker,

0 commit comments

Comments
 (0)