fix(ci): paginate upstream ci lookup
This commit is contained in:
@@ -132,23 +132,26 @@ jobs:
|
|||||||
print("✓ Workflow dispatch mode — upstream CI validation skipped")
|
print("✓ Workflow dispatch mode — upstream CI validation skipped")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
url = f"https://gitea.taxbaik.com/api/v1/repos/{repo}/actions/runs?limit=20"
|
|
||||||
req = urllib.request.Request(url, headers={"Authorization": f"token {token}"})
|
|
||||||
with urllib.request.urlopen(req, timeout=30) as resp:
|
|
||||||
payload = json.load(resp)
|
|
||||||
|
|
||||||
matched_ci = None
|
matched_ci = None
|
||||||
for run in payload.get("workflow_runs", []):
|
for page in range(1, 6):
|
||||||
path = str(run.get("path") or "")
|
url = f"https://gitea.taxbaik.com/api/v1/repos/{repo}/actions/runs?limit=50&page={page}"
|
||||||
if "ci.yml@" not in path:
|
req = urllib.request.Request(url, headers={"Authorization": f"token {token}"})
|
||||||
continue
|
with urllib.request.urlopen(req, timeout=30) as resp:
|
||||||
if run.get("status") != "completed" or run.get("conclusion") != "success":
|
payload = json.load(resp)
|
||||||
continue
|
|
||||||
actual_sha = str(run.get("head_sha") or "")
|
for run in payload.get("workflow_runs", []):
|
||||||
if actual_sha != expected_sha:
|
path = str(run.get("path") or "")
|
||||||
continue
|
if "ci.yml@" not in path:
|
||||||
matched_ci = run
|
continue
|
||||||
break
|
if run.get("status") != "completed" or run.get("conclusion") != "success":
|
||||||
|
continue
|
||||||
|
actual_sha = str(run.get("head_sha") or "")
|
||||||
|
if actual_sha != expected_sha:
|
||||||
|
continue
|
||||||
|
matched_ci = run
|
||||||
|
break
|
||||||
|
if matched_ci:
|
||||||
|
break
|
||||||
|
|
||||||
if not matched_ci:
|
if not matched_ci:
|
||||||
print("ERROR: No successful ci.yml run found for the release SHA")
|
print("ERROR: No successful ci.yml run found for the release SHA")
|
||||||
|
|||||||
Reference in New Issue
Block a user