Skip to content

Add workflow to auto-close PRs with merge conflicts#18

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/close-merge-conflict-prs
Draft

Add workflow to auto-close PRs with merge conflicts#18
Copilot wants to merge 2 commits intomasterfrom
copilot/close-merge-conflict-prs

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 7, 2026

Adds a GitHub Actions workflow that automatically detects and closes PRs that have merge conflicts with master.

Workflow: .github/workflows/close-conflicting-prs.yml

  • Triggers: push to master (scans all open PRs) and pull_request events (opened, synchronize, reopened)
  • Conflict detection: Polls mergeable_state via GitHub API — retries up to 5× with 10s backoff since GitHub computes this field asynchronously; treats 'dirty' as conflicting
  • On conflict: Posts a resolution guide comment, then closes the PR
  • Pagination: Fetches open PRs in pages of 100 to handle repos with large PR counts

Note: All 6 currently open PRs (#12#17) were verified to have no conflicts against master and are unaffected.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: zpratikpathak <49340667+zpratikpathak@users.noreply.github.com>
Copilot AI changed the title [WIP] Review and close pull requests with merge conflicts Add workflow to auto-close PRs with merge conflicts Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants