Skip to content

Commit 1fdc247

Browse files
authored
[RHAIENG-1567] : Add Mergify configuration for auto-merge and conflict handling (#34)
* Add Mergify configuration for auto-merge and conflict handling - Implemented rules for auto-merging pull requests when all conditions are met, including reviewer approvals and CI checks. - Added actions for handling merge conflicts, including labeling and commenting to notify authors. - Configured commit message template for merged pull requests. This setup aims to streamline the review process and improve collaboration efficiency. * Update Mergify configuration to enforce no failing checks for auto-merge * Refactor Mergify configuration to remove 'needs-rebase' label actions * Update Mergify configuration to simplify conflict handling by removing 'needs-rebase' label action * use approved_reviews_by instead of aproved_reviews * Fix formatting in Mergify configuration * Update Mergify configuration * Update Mergify configuration to correct author reference in merge conflict notification * Update Mergify configuration to clarify the purpose of the .mergify.yml file
1 parent c3de9b8 commit 1fdc247

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

.github/mergify.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# .mergify.yml defines the rules for merging pull requests.
2+
3+
pull_request_rules:
4+
# PRIMARY MERGE RULE: Single comprehensive rule for auto-merge
5+
- name: Auto-merge when ALL conditions met
6+
conditions:
7+
# ALL assigned reviewers must approve
8+
- "#approved-reviews-by>=1" # At least one approval
9+
- "#changes-requested-reviews-by=0" # No outstanding change requests
10+
- "#review-requested=0" # No pending review requests
11+
12+
# Add flexible check for all workflows:
13+
- "check-failure=~^$" # No failing checks allowed
14+
15+
# PR must be ready for merge
16+
- "-draft" # Not a draft
17+
- "base=main" # Targeting main branch
18+
- "label!=do-not-merge" # No blocking labels
19+
- "label!=breaking-change" # Important - requires special handling
20+
21+
# Technical requirements
22+
- "-conflict" # No merge conflicts
23+
24+
actions:
25+
merge:
26+
method: squash
27+
commit_message_template: |
28+
{{ title }} (#{{ number }})
29+
30+
{{ body.split('Description')[0].strip() if body else '' }}
31+
comment:
32+
message: |
33+
🎉 **Auto-merged successfully!**
34+
35+
✅ **All reviewers approved:** {{ approved_reviews_by | length }}
36+
✅ **CI checks passed:** All
37+
38+
**Approved by:**
39+
{% for login in approved_reviews_by %}
40+
- @{{ login }}
41+
{% endfor %}
42+
43+
- name: ping author on conflicts
44+
conditions:
45+
- "conflict"
46+
- "-closed"
47+
actions:
48+
comment:
49+
message: |
50+
🔀 **Merge Conflict Detected**
51+
52+
This pull request has merge conflicts that must be resolved before it can be merged.
53+
@{{ author }} please rebase your branch.
54+
55+
[Syncing a Fork Guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork)

0 commit comments

Comments
 (0)