You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(release): retry commit PR API with curl - #717
Fixes the remaining GitHub Draft Release v2 snapshot failures caused by truncated commit-to-PR responses on Actions runners.
The workflow now uses curl with transport retries, status validation, and JSON validation for each per_page=100 request. It remains fail-closed after the bounded outer retries and reports the affected commit SHA.
Validation
npm run test:release-workflow -- --run: 31 tests passed.
Shell simulation confirmed a truncated HTTP 200 body is retried and produces PULL_REQUESTS.json.
The combination of --retry-all-errors and || true can cause silent failures to be indistinguishable from genuine empty output. More importantly, --retry-all-errors retries on all errors including HTTP 4xx responses (e.g., 401 Unauthorized or 404 Not Found). A permanent 401 caused by an expired GH_TOKEN will burn through all 4 internal curl retries × 3 outer loop attempts (12 total fruitless API calls) before failing. Consider limiting retries to transient conditions: use --retry-connrefused instead of --retry-all-errors, or explicitly check for permanent HTTP error codes to break the outer loop early.
If jq -c '.[] | {...}' fails (e.g., a field like .base.ref is null or the array contains an unexpected object shape), it exits non-zero but the error is not caught because set -e does not apply inside a conditional's left-hand side after &&. The >> release-assets/PULL_REQUESTS.jsonl append happens regardless of whether jq partially wrote malformed records before erroring. Consider adding an explicit error check, or write to a temp file first and only append on a full-success exit code:
if tmp=$(jq -c '.[] | {...}'"$pr_response");thenprintf'%s\n'"$tmp">> release-assets/PULL_REQUESTS.jsonl
fi
On the final attempt (attempt=3), the warning message is printed and sleep 6 is executed unnecessarily before the loop exits. This adds 6 seconds of dead wait per failing commit SHA. Move the sleep inside a guard that checks attempt < 3, or restructure as [[ $attempt -lt 3 ]] && sleep "$((attempt * 2))".
💡 Suggested Change
Before:
echo "::warning title=Retrying pull request evidence::GitHub PR metadata for commit $commit_sha was unavailable or malformed (HTTP $http_status, attempt $attempt/3)." >&2
sleep "$((attempt * 2))"
After:
echo "::warning title=Retrying pull request evidence::GitHub PR metadata for commit $commit_sha was unavailable or malformed (HTTP $http_status, attempt $attempt/3)." >&2
[[ $attempt -lt 3 ]] && sleep "$((attempt * 2))"
Using --location (follow redirects) together with --header "Authorization: Bearer ${GH_TOKEN}" causes curl to forward the token to any redirect destination. If the GitHub API ever returns a redirect to a third-party host (including CDN endpoints or future URL changes), the bearer token is silently sent to that host. Use --location --proto-redir -all,https to limit redirects to HTTPS only, or replace --location with the explicit --proto '=https' flag, or better yet add --no-location since the GitHub REST API for this endpoint does not issue meaningful redirects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the remaining GitHub Draft Release v2 snapshot failures caused by truncated commit-to-PR responses on Actions runners.
The workflow now uses
curlwith transport retries, status validation, and JSON validation for eachper_page=100request. It remains fail-closed after the bounded outer retries and reports the affected commit SHA.Validation
npm run test:release-workflow -- --run: 31 tests passed.PULL_REQUESTS.json.