Skip to content

Added merge conflict label workflow#29

Open
dhruvi-16-me wants to merge 1 commit into
StabilityNexus:mainfrom
dhruvi-16-me:merge-conflict-label
Open

Added merge conflict label workflow#29
dhruvi-16-me wants to merge 1 commit into
StabilityNexus:mainfrom
dhruvi-16-me:merge-conflict-label

Conversation

@dhruvi-16-me
Copy link
Copy Markdown
Contributor

@dhruvi-16-me dhruvi-16-me commented Feb 26, 2026

Addressed Issues:

Fixes #(TODO: issue number)

Summary

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:

  • Improves PR triage visibility
  • Notifies contributors immediately when conflicts arise
  • Reduces manual maintainer intervention
  • Ensures PRs are conflict-free before review

Behavior

When merge conflicts appear:

  • Label added: PR has merge conflicts
  • Comment posted:

⚠️ This PR has merge conflicts.
Please resolve the merge conflicts before review.
Your PR will only be reviewed by a maintainer after all conflicts have been resolved.
Watch this video to understand why conflicts occur and how to resolve them.

When conflicts are resolved:

  • Label is automatically removed.

Testing

The full lifecycle was tested in an isolated test repository:

  • Conflict created → label + comment added
  • Conflict resolved → label removed
  • Subsequent base merges → re-check works correctly

Screenshots

Screenshot 2026-02-16 221209 Screenshot 2026-02-16 221254

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

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.

Summary by CodeRabbit

  • Chores
    • Implemented automated merge conflict detection for pull requests. PRs with merge conflicts will now be labeled and receive guidance comments to help developers resolve conflicts.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

Introduces a GitHub Actions workflow that automatically detects pull requests with merge conflicts, applies a "PR has merge conflicts" label, and posts a guidance comment with educational resources.

Changes

Cohort / File(s) Summary
Merge Conflict Detection Workflow
.github/workflows/label-merge-conflicts.yml
New GitHub Actions workflow that triggers on push and pull_request_target events to label PRs with merge conflicts using the eps1lon/actions-label-merge-conflict@v3 action and post a comment with conflict resolution guidance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • CI/CD: Automate "Merge Conflict" Labeling for PRs ContributorAutomation#13: This PR directly implements the automated merge conflict detection and labeling workflow for PRs, fulfilling the requirement to flag and provide guidance on merge conflicts.
  • StabilityNexus/Maelstrom-WebUI#47: This PR addresses the same objective of automatically detecting merge conflicts in PRs and applying labels with helpful comments.

Poem

🐰 Conflicts now caught with automated cheer,
Labels applied, guidance crystal clear,
No more missed merges, just smooth PR flow,
The workflow watches, helps contributors grow! 🎯

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Added merge conflict label workflow' is a concise, clear description that accurately summarizes the main change—adding a GitHub Actions workflow to automatically label PRs with merge conflicts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/label-merge-conflicts.yml (1)

3-6: Add branch filter to push trigger to avoid unnecessary workflow runs.

The push event without branch filters will trigger this workflow on every push to any branch in the repository. For detecting conflicts caused by base branch updates, you typically only need to run on pushes to your default/protected branches (e.g., main).

♻️ 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 push
trigger currently has no branch filter so the workflow runs on every push;
update the workflow's on: push configuration to include a branches filter (e.g.,
add branches: ['main'] or your repo's default/protected branches) so that only
pushes to the main/default branch trigger the workflow; keep the existing
pull_request_target: types unchanged. Reference the top-level keys in the
workflow (on:, push, pull_request_target) and add the branches array under push
to limit runs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/label-merge-conflicts.yml:
- Around line 3-6: The push trigger currently has no branch filter so the
workflow runs on every push; update the workflow's on: push configuration to
include a branches filter (e.g., add branches: ['main'] or your repo's
default/protected branches) so that only pushes to the main/default branch
trigger the workflow; keep the existing pull_request_target: types unchanged.
Reference the top-level keys in the workflow (on:, push, pull_request_target)
and add the branches array under push to limit runs.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e4f218 and eb4a0f8.

📒 Files selected for processing (1)
  • .github/workflows/label-merge-conflicts.yml

@KanishkSogani
Copy link
Copy Markdown
Member

@dhruvi-16-me can you please check why 1 github test is failing.

@KanishkSogani
Copy link
Copy Markdown
Member

@dhruvi-16-me fix this linting issue aswell for this PR.

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