Skip to content

Commit 3239af9

Browse files
committed
Handle multiple job failure URLs
CI has changed how jobs are being run 🤷
1 parent 2cff081 commit 3239af9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

misc/scripts/accept-expected-changes-from-ci.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,7 @@ def main(pr_number: Optional[int], sha_override: Optional[str] = None, force=Fal
280280
for lang_test_failure in lang_test_failures:
281281
job_failure_urls.add(lang_test_failure.target_url)
282282

283-
if job_failure_urls:
284-
assert len(job_failure_urls) == 1, f"Multiple job failure URLs: {job_failure_urls}"
285-
job_failure_url = job_failure_urls.pop()
286-
283+
for job_failure_url in job_failure_urls:
287284
# fixup URL. On the status, the target URL is the run, and it's really hard to
288285
# change this to link to the full `/runs/<run_id>/jobs/<numeric_job_id>` URL, since
289286
# the `<numeric_job_id>` is not available in a context: https://github.com/community/community/discussions/40291
@@ -301,6 +298,11 @@ def main(pr_number: Optional[int], sha_override: Optional[str] = None, force=Fal
301298

302299
for job in jobs["jobs"]:
303300
api_name: str = job["name"]
301+
302+
if api_name.lower().startswith(expected_workflow_name.lower()):
303+
lang_test_failure.job_id = job["id"]
304+
break
305+
304306
if " / " not in api_name:
305307
continue
306308

@@ -310,9 +312,11 @@ def main(pr_number: Optional[int], sha_override: Optional[str] = None, force=Fal
310312
if workflow_name == expected_workflow_name and job_name.lower().startswith(lang_test_failure.context.lower()):
311313
lang_test_failure.job_id = job["id"]
312314
break
313-
else:
314-
LOGGER.error(f"Could not find job for {lang_test_failure.context!r}")
315-
sys.exit(1)
315+
316+
for lang_test_failure in lang_test_failures:
317+
if lang_test_failure.job_id is None:
318+
LOGGER.error(f"Could not find job for {lang_test_failure.context!r}")
319+
sys.exit(1)
316320

317321
# Ruby/Swift/C#/Go use github actions, and not internal CI. These are not reported
318322
# from the /statuses API, but from the /check-suites API

0 commit comments

Comments
 (0)