9292 check_run_id: check_run_id
9393 })
9494
95+ // For temporary debugging purposes to see the structure of the annotations.
96+ console.print(annotations);
97+
98+ has_failed_job = false;
99+ saved_failure_message = null;
100+
95101 for (annotation of annotations.data) {
96102 if (annotation.annotation_level != 'failure') {
97103 continue;
@@ -106,15 +112,32 @@ jobs:
106112
107113 const failure_match = annotation.message.match(failure_regex);
108114 if (failure_match != null) {
109- // We only want to restart the workflow if all of the failures were due to preemption.
110- // We don't want to restart the workflow if there were other failures.
111- core.notice('Choosing not to rerun workflow because we found a non-preemption failure' +
112- 'Failure message: "' + annotation.message + '"');
113- await create_check_run('skipped', 'Choosing not to rerun workflow because we found a non-preemption failure\n'
114- + 'Failure message: ' + annotation.message)
115- return;
115+ has_failed_job = true;
116+ saved_failure_message = annotation.message;
116117 }
117118 }
119+ if (has_failed_job && (! has_preempted_job)) {
120+ // We only want to restart the workflow if all of the failures were due to preemption.
121+ // We don't want to restart the workflow if there were other failures.
122+ //
123+ // However, libcxx runners running inside docker containers produce both a preemption message and failure message.
124+ //
125+ // The desired approach is to ignore failure messages which appear on the same job as a preemption message
126+ // (An job is a single run with a specific configuration, ex generic-gcc, gcc-14).
127+ //
128+ // However, it's unclear that this code achieves the desired approach, and it may ignore all failures
129+ // if a preemption message is found at all on any run.
130+ //
131+ // For now, it's more important to restart preempted workflows than to avoid restarting workflows with
132+ // non-preemption failures.
133+ //
134+ // TODO Figure this out.
135+ core.notice('Choosing not to rerun workflow because we found a non-preemption failure' +
136+ 'Failure message: "' + saved_failure_message + '"');
137+ await create_check_run('skipped', 'Choosing not to rerun workflow because we found a non-preemption failure\n'
138+ + 'Failure message: ' + saved_failure_message)
139+ return;
140+ }
118141 }
119142
120143 if (!has_preempted_job) {
0 commit comments