From c3ed59a683bdc3441d2d68081ed28a621c11b98c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 31 Aug 2026 14:25:13 +0000 Subject: [PATCH] build(workflows): stream PR list when checking for duplicate PRs The `check_duplicate_prs` workflow has failed on four of the last five nightly runs against `develop`. The "Check for duplicate PRs" step aborts with `The action 'Check for duplicate PRs' has timed out after 15 minutes.` shortly after reporting `Processed 900 PRs...`. The script accumulates every open pull request into a single JSON array and then indexes into that array once per pull request via `jq -c ".[$i]"`. Each of those invocations re-parses the entire array, which is roughly 4 MB at the current ~950 open pull requests, making the loop quadratic. Job logs show a steady 47 seconds per 50 pull requests, which puts a full pass just past the step's 15 minute budget. Stream the array through a single `jq -c '.[]'` invocation and drive the loop with `read` instead, so that the list is parsed once rather than once per pull request. Process substitution keeps the loop body in the current shell, so the accumulated issue-to-PR arrays are unaffected. Against a mocked API and a 122 pull request fixture covering null bodies, empty bodies, a null array element, and a null pull request number, the script's stdout and stderr are byte-identical to before the change. Ref: https://github.com/stdlib-js/stdlib/actions/runs/33352880096 --- .github/workflows/scripts/check_duplicate_prs/run | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/scripts/check_duplicate_prs/run b/.github/workflows/scripts/check_duplicate_prs/run index 07c45303a604..ddcd796cdf60 100755 --- a/.github/workflows/scripts/check_duplicate_prs/run +++ b/.github/workflows/scripts/check_duplicate_prs/run @@ -255,14 +255,12 @@ main() { echo "Processing PRs for issue references..." debug_log "Starting to process $total_prs PRs for issue references" - # Process PRs one by one... + # Process PRs one by one, streaming the list through a single `jq` invocation in order to avoid re-parsing the entire list once per PR... processed_count=0 - for ((i=0; i