feat(automerge): scheduled sweep for stale auto-merge queue#162
Open
JacobPEvans wants to merge 3 commits intomainfrom
Open
feat(automerge): scheduled sweep for stale auto-merge queue#162JacobPEvans wants to merge 3 commits intomainfrom
JacobPEvans wants to merge 3 commits intomainfrom
Conversation
GitHub's auto-merge sometimes goes stale: PR is CLEAN with auto-merge enabled but the merge never executes. Toggling auto-merge off/on forces re-evaluation and the merge completes within seconds. This replaces the unmerged 500-line healer (feat/automerge-reliability) with a 70-line workflow that runs every 10 minutes across all repos. (claude)
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an organization-level scheduled GitHub Actions workflow to periodically “poke” PRs that appear merge-ready with auto-merge enabled but are stuck in GitHub’s stale auto-merge queue, by toggling auto-merge off/on using a GitHub App token.
Changes:
- Introduces a new
automerge-sweepcron workflow running every 10 minutes. - Enumerates open PRs in a fixed list of repos and filters to trusted bot PRs with
autoMergeRequest != nullandmergeStateStatus == CLEAN. - Disables and re-enables auto-merge via
gh pr mergeto force GitHub to re-evaluate the queue.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…mit, regex, merge method, error surfacing
- Add workflow-level concurrency group (cancel-in-progress) to prevent overlapping sweeps
- Set job permissions: {} — GITHUB_TOKEN is unused; App token carries its own permissions
- Add --limit 1000 to gh pr list to avoid missing stuck PRs in busy repos
- Tighten author regex to exact [bot] suffix + $ anchor (prevents false prefix matches)
- Read autoMergeRequest.mergeMethod and pass appropriate flag instead of hard-coding --squash
- Replace || true with ::warning:: annotations so failures surface in Actions logs
…equests needed gh pr merge and gh pr list require pull-requests:write only; contents:write was unused and violates least-privilege.
This was referenced Apr 13, 2026
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.
PR #162 Metadata Update
Summary
automerge-sweep.yml— a 70-line cron workflow that runs every 10 minutesauto-merge is enabled +
mergeStateStatus == CLEANbut GitHub hasn't executed the mergebug)
feat/automerge-reliabilitybranch (500+ lines, 3 scripts) withminimal code
Context
GitHub's native auto-merge queue sometimes goes stale — a PR has all checks green,
auto-merge enabled, and
mergeStateStatus=CLEAN, but the merge never executes. The onlyknown fix is toggling auto-merge off/on. The existing inline retry in
_release-please.ymlhandles initial creation, but nothing catches the stale queue after that. PRs were sitting
for 1-2 hours before eventual manual intervention.
Changes
poke stale auto-merge queue every 10 minutes
permissions scoping, result limits, regex patterns, merge method handling, and error
surfacing
Test Plan
ansible-proxmox-apps#177— merged instantly after pokenix-ai#492— checks re-running, will merge on completiongh workflow run automerge-sweep.ymlafter merge to verify cron worksRelated
🤖 Generated with Claude Code