Problem
scripts/cancel_github_workflows.py uses requests.request(...) without a timeout and assumes every response body can be parsed as JSON. In CI or local maintenance workflows this can hang indefinitely or hide HTTP status failures behind confusing JSON errors.
Proposed remediation
Make the GitHub API helper fail fast and report clearer errors.
Acceptance criteria
- Add a sensible request timeout for every GitHub API call.
- Call
raise_for_status() or otherwise surface non-2xx responses before consuming the response body.
- Preserve the existing Click CLI behavior and error style.
- Add focused unit tests around the
request() helper if practical.
Suggested validation
python -m py_compile scripts/cancel_github_workflows.py
- Focused tests for successful JSON, API error message, non-JSON/HTTP error, and timeout behavior if a lightweight test location exists.
Problem
scripts/cancel_github_workflows.pyusesrequests.request(...)without a timeout and assumes every response body can be parsed as JSON. In CI or local maintenance workflows this can hang indefinitely or hide HTTP status failures behind confusing JSON errors.Proposed remediation
Make the GitHub API helper fail fast and report clearer errors.
Acceptance criteria
raise_for_status()or otherwise surface non-2xx responses before consuming the response body.request()helper if practical.Suggested validation
python -m py_compile scripts/cancel_github_workflows.py