Repository navigation
fix: retry the Dependabot merge when another merge modifies the base branch - #183
Merged
Merged
Conversation
Contributor
|
🎉 This PR is included in version 1.27.10 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Intent
Whenever "Looks good to me" (LGTM) is commented on a Dependabot PR, the PR should merge automatically, but some PRs do not. Troubleshoot it; if the problem is in the reusable workflow, open a pull request in that repository and fix it.
Context from firstmate's diagnosis: in dnlopes/Blog.TodosParaAMesa, PR 150 was approved by the code owner, and the reusable
dependabot-merge.yamljob then rangh pr merge 150 --auto --squash. All required checks had already passed, soghtried to merge immediately. PR 151 merged intomainat 2026-10-24T15:59:02Z; one second later the PR 150 merge failed withGraphQL: Base branch was modified. Review and try the merge again. (mergePullRequest)and the job exited 1. Nothing retries, so the PR stays approved but unmerged and without auto-merge. This race happens whenever two or more Dependabot PRs are approved close together.What Changed
request_mergehelper to.github/workflows/dependabot-merge.yaml. The helper wrapsgh pr merge --auto --squashand retries up to 5 times when the merge fails withBase branch was modified. It waits 5, 10, 15, then 20 seconds between attempts.request_mergeinstead ofgh pr mergewhen a code owner submits a review. This fixes the race in which 2 Dependabot PRs are approved close together. Before, the second merge failed and the PR stayed approved but unmerged.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change adds a bounded retry of about 50 seconds to the only merge call,
pull_request_review, and retries only on the exactBase branch was modifiederror from the diagnosis; other errors still fail as before.Testing
I parsed the real step script out of the workflow YAML at the base and target commits and ran it with bash 3.2. A fake
ghsimulated the GitHub API, and a fakesleeprecorded back-off timing. The base commit exits 1 on one "Base branch was modified" failure, which reproduces the reported bug. The fix retries and merges, and every adversarial case behaves as intended. GitHub was stubbed, so no scenario counts as live. A live run needs a real repository, a code-owner PAT, and two Dependabot PRs approved close together. This is a CI-workflow-only change with no surface no-mistakes can drive. The worktree stays clean, and the harness and transcript live in the evidence directory.Evidence: Merge race harness transcript (base and fix, 7 runs)
~/.no-mistakes/evidence/01M5QBSCNMWB1F391NXBVZ6WG9/harness)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
ruby extract.rb .github/workflows/dependabot-merge.yaml(parses the workflow YAML and pulls out therunscript of the step named "Approve, merge, or rebase", for the target and base commits)drive.sh run-base.shwithMERGE_FAILS=1: base-commit reproduction of the racedrive.sh run-head.shwithMERGE_FAILSset to 0, 1, 3, and 99 (race scenarios)drive.sh run-head.shwithMERGE_ERROR='Pull request is not mergeable'(unrelated error, no retry expected)drive.sh run-head.shwithREVIEW_AUTHOR=someone-else(review by someone who is not a code owner)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.