fix(lock-release): don't fail on PRs with merge conflicts#7572
fix(lock-release): don't fail on PRs with merge conflicts#7572hectahertz merged 1 commit intomainfrom
Conversation
|
There was a problem hiding this comment.
Pull request overview
Adjusts the lock-release GitHub Actions workflow so the unlock job doesn’t fail just because some auto-merge PRs can’t be updated due to merge conflicts, avoiding false “failed” unlock runs when rulesets toggling succeeded.
Changes:
- Replaces the
xargs-basedgh pr update-branchinvocation with aforloop. - Converts per-PR update failures into warnings so the job can continue.
| for pr in $PR_NUMBERS; do | ||
| gh pr update-branch -R primer/react "$pr" || echo "Warning: failed to update PR #$pr (likely has conflicts)" | ||
| done |
There was a problem hiding this comment.
gh pr update-branch ... || echo ... will now treat any update-branch failure as a success (not just merge-conflict failures). That can mask real problems like auth/permission issues or GitHub API outages and still report the workflow as successful. Consider detecting/ignoring only the known conflict case (or at least tracking failures and failing the step if all/most updates fail), while still continuing past individual conflict errors.
| for pr in $PR_NUMBERS; do | |
| gh pr update-branch -R primer/react "$pr" || echo "Warning: failed to update PR #$pr (likely has conflicts)" | |
| done | |
| failed=0 | |
| for pr in $PR_NUMBERS; do | |
| if ! output=$(gh pr update-branch -R primer/react "$pr" 2>&1); then | |
| if echo "$output" | grep -qi "merge conflict"; then | |
| echo "Warning: failed to update PR #$pr (merge conflict detected)" | |
| else | |
| echo "Error: failed to update PR #$pr due to an unexpected error" | |
| echo "$output" | |
| failed=1 | |
| fi | |
| fi | |
| done | |
| if [ "$failed" -ne 0 ]; then | |
| echo "One or more PR updates failed due to unexpected errors." | |
| exit 1 | |
| fi |
|
Sharing the diagnosis. The fix here silently swallows per-PR failures which isn't great either. Root cause: The "Update all PRs" step uses Some options:
Leaving this for you to decide since you have more context on the intended behavior @llastflowers! |
Closes #
The
lock-releaseunlock workflow has been failing because the "Update all PRs" step usesxargsto callgh pr update-branchfor each auto-merge PR. When any PR has merge conflicts,gh pr update-branchexits non-zero,xargspropagates exit code 123, and the whole job fails under bash's-eflag.This means the unlock step was reported as failed even though the rulesets were toggled successfully. The only "failure" was that some PRs had conflicts and couldn't be updated, which is expected and shouldn't block the workflow.
Replaced
xargswith aforloop that gracefully handles per-PR failures with|| echo "Warning: ...".Changelog
New
N/A
Changed
lock-releaseunlock step no longer fails when some PRs have merge conflictsRemoved
N/A
Rollout strategy
Testing & Reviewing
This was diagnosed from the recent run logs. The rulesets toggle fine, but the PR update step fails:
Merge checklist