diff --git a/.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py b/.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py index 76d8e488bce5..2b91c862a7f6 100644 --- a/.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py +++ b/.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py @@ -188,10 +188,14 @@ def filter_workflow_runs(run, issue): print(f"Success rate: {success_rate}") - # Check if last 5 runs are all failures - last_5_failed = len(workflow_runs) >= 5 and all(run.status == "failure" for run in workflow_runs[:5]) + # Check if last 5 runs are all failures or cancelled (e.g. job timeout) + last_5_failed = len(workflow_runs) >= 5 and all( + run.status in ("failure", "cancelled") for run in workflow_runs[:5] + ) if last_5_failed: - print(f"The last 5 workflow runs for {workflow.name} have all failed") + print( + f"The last 5 workflow runs for {workflow.name} have all failed or been cancelled" + ) return success_rate < workflow.threshold or last_5_failed