Skip to content

Commit b3d170d

Browse files
committed
Add filter=all and pagination to detect all check-run attempts in detect_rerun_checks
1 parent 41ebf28 commit b3d170d

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

packages/gen-ai/.claude/skills/flake-check/scripts/fetch_pr_failures.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,21 @@ def detect_rerun_checks(repo: str, sha: str) -> list[str]:
8989
Silently returns empty list on API error.
9090
"""
9191
try:
92-
raw = run_gh("api", f"repos/{repo}/commits/{sha}/check-runs?per_page=100")
93-
data = json.loads(raw)
92+
check_runs: list[dict] = []
93+
page = 1
94+
while True:
95+
raw = run_gh("api", f"repos/{repo}/commits/{sha}/check-runs?per_page=100&filter=all&page={page}")
96+
data = json.loads(raw)
97+
runs = data.get("check_runs", [])
98+
check_runs.extend(runs)
99+
if len(runs) < 100:
100+
break
101+
page += 1
94102
except (SystemExit, json.JSONDecodeError):
95103
return []
96104

97105
by_name: dict[str, list[tuple[str, str]]] = defaultdict(list)
98-
for run in data.get("check_runs", []):
106+
for run in check_runs:
99107
name = run.get("name", "")
100108
conclusion = (run.get("conclusion") or "").lower()
101109
started_at = run.get("started_at") or ""

0 commit comments

Comments
 (0)