Conversation
There was a problem hiding this comment.
Pull request overview
Updates the PR conflict-labeling workflow to detect committed git conflict markers in PR diffs (a case where GitHub’s mergeability API can still report the PR as mergeable), improving safety for Mergify backport PRs.
Changes:
- Add
gh pr diffretrieval to fetch PR diffs for additional conflict detection. - Implement regex-based scanning for committed conflict markers in added lines.
- Extend conflict determination and PR processing to incorporate marker detection and logging.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dmbaturin
approved these changes
Feb 16, 2026
Member
dmbaturin
left a comment
There was a problem hiding this comment.
It looks at least superficially correct to me. Let's give it a try.
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.
Change Summary
Mergify backport PRs with cherry-pick conflicts contain committed conflict markers (<<<<<<<, =======, >>>>>>>). GitHub's API treats these as valid changes and marks the PR as "mergeable", causing the script to incorrectly remove conflict labels and allow unsafe merges.
Solution
Added diff-based conflict detection to identify committed conflict markers alongside GitHub's native mergeability checks.
Changes
get_pr_diff() - Fetches PR diffs using gh pr diff CLI
has_conflict_markers() - Scans diff for git conflict markers using regex
has_conflicts() - Updated to return True if GitHub detects conflicts OR markers found
process_pr() - Enhanced to check diff content and log marker detection
Imports - Added subprocess and re
Benefits
✅ Detects Mergify backport PRs with committed conflicts
✅ Prevents unsafe merges of conflicted PRs
✅ Maintains backward compatibility
✅ Graceful degradation if gh CLI unavailable
✅ Enhanced logging for debugging
Validation
Validated with https://github.com/VyOS-Networks/gh-action-test-vyos-1x/actions/runs/21835978019/job/63007028032
Types of changes
Related Task(s)
https://vyos.dev/T8246Related PR(s)
Proposed changes
How to test
Checklist: