Skip to content

Conversation

@raman325
Copy link
Owner

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 --auto would merge immediately since there are no required status checks in branch protection rules. Now we:

  1. Use gh pr checks --watch --fail-fast to wait for all checks to complete
  2. Only merge (with gh pr merge --squash) after checks pass

This 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

  • Maintenance (non-breaking change that improves the codebase)

Additional information

  • This PR is related to issue: N/A

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 12, 2026 22:57
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>
@raman325 raman325 force-pushed the fix/auto-merge-wait-for-ci branch from e18717c to ccf2f9a Compare January 12, 2026 22:57
@raman325 raman325 merged commit 080d650 into main Jan 12, 2026
6 checks passed
@raman325 raman325 deleted the fix/auto-merge-wait-for-ci branch January 12, 2026 22:58
Copy link
Contributor

Copilot AI left a 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.

Comment on lines +24 to +28
- 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
Copy link

Copilot AI Jan 12, 2026

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).

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +50
- name: Wait for CI checks to pass
run: gh pr checks "$PR_URL" --watch --fail-fast
Copy link

Copilot AI Jan 12, 2026

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).

Copilot uses AI. Check for mistakes.
@raman325 raman325 added the github-config Changes to .github/ configuration files label Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github-config Changes to .github/ configuration files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants