From 9af81447581bd0c2dd15c65fe90372b43f1352cc Mon Sep 17 00:00:00 2001 From: JohnnyVicious Date: Sun, 12 Apr 2026 19:59:34 +0200 Subject: [PATCH] fix(release): retry gh pr merge to cover GraphQL propagation lag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v1.0.4 release (run 24312750234) failed at step 11 with: Created release PR: https://github.com/.../pull/53 GraphQL: Could not resolve to a PullRequest with the number of 53. ##[error]Process completed with exit code 1. `gh pr create` had returned the PR URL synchronously, but `gh pr merge` fired ~500ms later and hit GraphQL's eventual- consistency lag — the PR node wasn't yet resolvable from the merge endpoint even though it had just been created. By the time I checked manually the PR was fully mergeable, confirming it was a pure propagation race and not a real auth/permission failure. Wrap `gh pr merge` in a 5-attempt retry loop with a 2s backoff. Worst case the workflow spends an extra 8s; best case the first attempt still wins. The v1.0.2 and v1.0.3 releases didn't hit this because they happened to land on the fast side of the race, so the fix is hardening against a flaky GitHub API, not a new failure mode. --- .github/workflows/release.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df17a68..1d284cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,7 +110,23 @@ jobs: --title "chore(release): v${version}" \ --body "Automated release PR generated by \`.github/workflows/release.yml\`. Bumps every version-bearing manifest to v${version}.") echo "Created release PR: $pr_url" - gh pr merge "$pr_url" --squash --delete-branch + + # `gh pr create` returns synchronously but GraphQL's PR node + # is eventually consistent — the v1.0.4 release hit a race + # where `gh pr merge` fired ~500ms after create and got: + # "Could not resolve to a PullRequest with the number of N" + # Retry up to 5 times with a 2s backoff to cover propagation. + for attempt in 1 2 3 4 5; do + if gh pr merge "$pr_url" --squash --delete-branch; then + break + fi + if [ "$attempt" = "5" ]; then + echo "::error::gh pr merge still failing after 5 attempts" + exit 1 + fi + echo "gh pr merge attempt $attempt failed (likely GraphQL lag); retrying in 2s..." + sleep 2 + done - name: Tag the merged commit on main run: |