add merge conflict labelling workflow#8
Conversation
WalkthroughA new GitHub Actions workflow is introduced that automatically detects merge conflicts in pull requests. When conflicts are discovered, the workflow labels the PR with "PR has merge conflicts" and posts a comment instructing maintainers to resolve conflicts before proceeding with review. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/label-merge-conflicts.yml:
- Around line 3-6: The workflow's unscoped push trigger causes runs on every
branch; narrow the trigger by changing the top-level on: push to only target the
base branch (e.g., replace the bare "push:" with "push: branches: [main]") so
the workflow only runs when main is updated, while keeping the existing
pull_request_target: types: [opened, reopened, synchronize] intact; update the
YAML around the on/push/pull_request_target keys accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 392175c6-59c5-4b37-98f7-ce0854998c40
📒 Files selected for processing (1)
.github/workflows/label-merge-conflicts.yml
| on: | ||
| push: | ||
| pull_request_target: | ||
| types: [opened, reopened, synchronize] |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider scoping the push trigger to specific branches.
The unfiltered push trigger fires on every push to every branch, which may cause unnecessary workflow runs. Typically, you only need to re-check PRs for conflicts when the base branch (e.g., main) is updated.
♻️ Suggested improvement
on:
push:
+ branches:
+ - main
pull_request_target:
types: [opened, reopened, synchronize]🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/label-merge-conflicts.yml around lines 3 - 6, The
workflow's unscoped push trigger causes runs on every branch; narrow the trigger
by changing the top-level on: push to only target the base branch (e.g., replace
the bare "push:" with "push: branches: [main]") so the workflow only runs when
main is updated, while keeping the existing pull_request_target: types: [opened,
reopened, synchronize] intact; update the YAML around the
on/push/pull_request_target keys accordingly.
Addressed Issues:
This PR introduces an automated workflow that labels pull requests with merge conflicts using eps1lon/actions-label-merge-conflict.
When a PR has merge conflicts:
A label “PR has merge conflicts” is automatically added.
A comment is posted notifying the contributor.
The label is automatically removed once conflicts are resolved.
Why This Change?
Currently, maintainers must manually identify and notify contributors when their PR requires rebasing. This creates unnecessary review overhead and delays.
This workflow:
Behavior
When merge conflicts appear:
Label added: PR has merge conflicts
When conflicts are resolved:
Label is automatically removed.
Screenshots/Recordings:
TODO: If applicable, add screenshots or recordings that demonstrate the interface before and after the changes.
Additional Notes:
AI Usage Disclosure:
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Check one of the checkboxes below:
I have used the following AI models and tools: TODO
Checklist
Summary by CodeRabbit