-
Notifications
You must be signed in to change notification settings - Fork 11
Fix auto-merge to wait for CI checks before merging #779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Use gh pr checks --watch to wait for all CI checks to complete and pass before merging bot PRs, instead of using --auto which merges immediately without required status checks. Applies to both dependabot and pre-commit-ci PRs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
e18717c to
ccf2f9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR attempts to fix the auto-merge workflow to wait for CI checks before merging pre-commit-ci and Dependabot PRs. Instead of using GitHub's auto-merge feature (gh pr merge --auto), it switches to explicitly waiting for checks with gh pr checks --watch and then merging with gh pr merge --squash.
Changes:
- Split auto-merge into two steps: wait for CI checks, then merge
- Applied the same pattern to both Dependabot and pre-commit-ci jobs
- Updated comments to reflect the new behavior
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Wait for CI checks to pass | ||
| if: >- | ||
| steps.metadata.outputs.update-type == 'version-update:semver-patch' || | ||
| steps.metadata.outputs.update-type == 'version-update:semver-minor' | ||
| run: gh pr merge --auto --squash "$PR_URL" | ||
| run: gh pr checks "$PR_URL" --watch --fail-fast |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step will create a deadlock. The auto-merge workflow runs on pull_request events, which means it shows up as a check on the PR itself. When gh pr checks --watch executes, it will wait for ALL checks to complete, including this workflow, causing it to wait for itself indefinitely. The workflow should either exclude itself from the checks it waits for, or use a different trigger event that doesn't add itself as a check (such as workflow_run or check_suite).
| - name: Wait for CI checks to pass | ||
| run: gh pr checks "$PR_URL" --watch --fail-fast |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step will create a deadlock. The auto-merge workflow runs on pull_request events, which means it shows up as a check on the PR itself. When gh pr checks --watch executes, it will wait for ALL checks to complete, including this workflow, causing it to wait for itself indefinitely. The workflow should either exclude itself from the checks it waits for, or use a different trigger event that doesn't add itself as a check (such as workflow_run or check_suite).
Proposed change
Fix the auto-merge workflow for pre-commit-ci PRs to wait for CI checks to complete before merging.
Previously, using
gh pr merge --autowould merge immediately since there are no required status checks in branch protection rules. Now we:gh pr checks --watch --fail-fastto wait for all checks to completegh pr merge --squash) after checks passThis allows pre-commit-ci updates to auto-merge only when CI passes, while still allowing manual merges when checks fail for other PRs.
Type of change
Additional information
🤖 Generated with Claude Code