Fix auto-merge green on error - #131
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the auto-merge workflow step so that automation PR merges fail the job when the merge does not actually succeed, preventing “green” CI outcomes on merge errors. It also adds a bounded retry loop and verifies merge success via server state.
Changes:
- Add a 3-attempt retry loop around
gh pr mergefor automation PRs. - Verify merge success via
gh pr view ... --json mergedand fail the job if not merged after retries. - Emit warnings per failed merge attempt and a final error on failure.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
347f941 to
69bc43d
Compare
| MERGE_ERR="$(mktemp)" | ||
| while [ "$n" -le "$ATTEMPTS" ]; do | ||
| gh pr merge "$PR_NUMBER" --repo "$REPO" --merge --admin --delete-branch \ | ||
| || echo "::warning::Auto-merge attempt $n/$ATTEMPTS failed for PR #$PR_NUMBER" |
There was a problem hiding this comment.
Should we make it error out? If not, why not?
There was a problem hiding this comment.
This is attempt 1 of N. If it continues to fail, then the loop proceeds to line 1404 where it exits 1. It warns here instead of failing to catch transient errors that a retry would fix, e.g. the 504 error we saw in cpython.
Auto-merge returns green on error. This fixes that. Also adds a 3-round retry for transient errors and a post-op check to ensure the merge succeeded.