scripts: de-duplicate and harden the close_pull_requests_with_*.sh backlog jobs - #15169
scripts: de-duplicate and harden the close_pull_requests_with_*.sh backlog jobs#15169priya-sundaram-dev wants to merge 1 commit into
Conversation
…cklog jobs Extract the five byte-for-byte-identical backlog-closing scripts into one parameterized close_pull_requests_with_label.sh and make each named script a thin wrapper. Addresses the recommendations from TheAlgorithms#15168: - Correctness: filter by label server-side (gh pr list --label) instead of listing all ~900 open PRs and matching client-side, so no PR is skipped by an arbitrary --limit cap. - De-duplication: one implementation removes the drift between copies (some had sleep 2, one had it commented out, two had none). - Throttling: a single, deliberate SLEEP (default 2s) between closes. - Safety rails: set -euo pipefail, explicit --repo, and a DRY_RUN=1 preview mode that prints what would close before a maintainer commits. - Machine-readable summary (CLOSED_COUNT/CLOSED_PRS) so the Hacktoberfest tracker can be updated from script output. Follow-up to TheAlgorithms#15081.
Closing this pull request as invalid@priya-sundaram-dev, this pull request is being closed as the files submitted contains an invalid extension. This repository only accepts Python algorithms. Please read the Contributing guidelines first. Invalid files in this pull request: |
Closing this pull request as invalid@priya-sundaram-dev, this pull request is being closed as the files submitted contains an invalid extension. This repository only accepts Python algorithms. Please read the Contributing guidelines first. Invalid files in this pull request: |
|
Heads-up: CI is green (build / build_docs / ruff all ✅). @cclauss, happy for you to reopen when convenient, or I can resubmit however you prefer (e.g. as a follow-up to the tracker in #15168). No rush. |
|
I want I will rebuild the PR under my name (giving you credit) and get another maintainer to review it. |
|
Sounds good — agree that keeping |
As requested by @cclauss in #15081 (comment)... — the follow-up PR applying the script recommendations I made in #15168.
What changed
The five
scripts/close_pull_requests_with_*.shjobs were byte-for-byte identical apart from one label name and one comment string. This PR extracts the shared logic into one parameterizedclose_pull_requests_with_label.shand turns each named script into a one-line wrapper, so the existing entry points (referenced indocs/hacktober_2026_prep.md) keep working.Each recommendation from #15168, applied:
gh pr list --state open --limit 500and matched labels injq. With ~900 open PRs, any matching PR past the 500th was never closed. The new script filters server-side withgh pr list --label "<label>", so the cap can't hide PRs (and it's much faster — it fetches only the matching PRs).awaiting_changes/failing_testshadsleep 2,require_testshad it commented out, and the other two had none.SLEEP(default 2s) between closes to avoid tripping GitHub's secondary rate limits during bulk closes.set -euo pipefail, an explicit--repo(overridable viaREPO=), and aDRY_RUN=1mode that prints exactly what would close before a maintainer commits.CLOSED_COUNT=<n> CLOSED_PRS=<...>sodocs/hacktober_2026_prep.mdcan be updated from the output instead of by hand.Verification
bash -npasses on all six files.Behaviour of the named scripts is unchanged for a maintainer running them; they just share one hardened implementation now.
Checklist
scripts/; no algorithm added.