Skip to content

Commit fc243b7

Browse files
authored
Handle cancelled workflow runs in flaky test detection tool (#37072)
1 parent 314d040 commit fc243b7

File tree

1 file changed

+4
-5
lines changed
  • .test-infra/metrics/sync/github/github_runs_prefetcher/code

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def filter_workflow_runs(run, issue):
182182

183183
success_rate = 1.0
184184
if len(workflow_runs):
185-
failed_runs = list(filter(lambda r: r.status == "failure", workflow_runs))
185+
failed_runs = list(filter(lambda r: r.status == "failure" | r.status == "cancelled", workflow_runs))
186186
print(f"Number of failed workflow runs: {len(failed_runs)}")
187187
success_rate -= len(failed_runs) / len(workflow_runs)
188188

@@ -285,13 +285,12 @@ async def fetch_workflow_runs():
285285
def append_workflow_runs(workflow, runs):
286286
workflow_runs = {}
287287
for run in runs:
288-
# Getting rid of all runs with a "skipped" status to display
289-
# only actual runs
288+
# Getting rid of all "skipped" runs to display only actual runs
289+
# Possible values for run["status"] are ["queued", "in_progress", "completed"]
290290
if run["conclusion"] != "skipped":
291-
status = ""
292291
if run["status"] == "completed":
293292
status = run["conclusion"]
294-
elif run["status"] != "cancelled":
293+
else:
295294
status = run["status"]
296295
workflow_run = WorkflowRun(
297296
run["id"],

0 commit comments

Comments
 (0)