Skip to content

Commit db15fff

Browse files
authored
Count cancelled runs in last-5 flaky check (#38614)
1 parent d901481 commit db15fff

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • .test-infra/metrics/sync/github/github_runs_prefetcher/code

.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,14 @@ def filter_workflow_runs(run, issue):
188188

189189
print(f"Success rate: {success_rate}")
190190

191-
# Check if last 5 runs are all failures
192-
last_5_failed = len(workflow_runs) >= 5 and all(run.status == "failure" for run in workflow_runs[:5])
191+
# Check if last 5 runs are all failures or cancelled (e.g. job timeout)
192+
last_5_failed = len(workflow_runs) >= 5 and all(
193+
run.status in ("failure", "cancelled") for run in workflow_runs[:5]
194+
)
193195
if last_5_failed:
194-
print(f"The last 5 workflow runs for {workflow.name} have all failed")
196+
print(
197+
f"The last 5 workflow runs for {workflow.name} have all failed or been cancelled"
198+
)
195199

196200
return success_rate < workflow.threshold or last_5_failed
197201

0 commit comments

Comments
 (0)