From 4f21677ae52b9842d20c0ba951b3255dbbb6dfa6 Mon Sep 17 00:00:00 2001 From: noah Date: Wed, 14 Oct 2026 19:58:13 -0600 Subject: [PATCH] Ignore cancelled runs in completed CI badge --- ci/last-attempt-badge.py | 2 +- ci/test-last-attempt-badge.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/last-attempt-badge.py b/ci/last-attempt-badge.py index c77bdb1..fd58560 100644 --- a/ci/last-attempt-badge.py +++ b/ci/last-attempt-badge.py @@ -51,7 +51,7 @@ def latest_completed(api: str, repo: str, workflow: str, branch: str, for run in runs: if run.get("head_branch") != branch or run.get("status") != "completed": continue - if run.get("conclusion") not in ("success", "failure", "cancelled", "skipped"): + if run.get("conclusion") not in ("success", "failure"): continue candidate = (int(run["id"]), run["conclusion"]) if latest is None or candidate[0] > latest[0]: diff --git a/ci/test-last-attempt-badge.py b/ci/test-last-attempt-badge.py index 2c19243..e954512 100644 --- a/ci/test-last-attempt-badge.py +++ b/ci/test-last-attempt-badge.py @@ -15,6 +15,7 @@ spec.loader.exec_module(module) def runs(_url, _token): return {"workflow_runs": [ + {"id": 105, "head_branch": "main", "status": "completed", "conclusion": "cancelled"}, {"id": 104, "head_branch": "main", "status": "queued", "conclusion": None}, {"id": 103, "head_branch": "main", "status": "completed", "conclusion": "failure"}, {"id": 102, "head_branch": "main", "status": "completed", "conclusion": "success"},