-
Notifications
You must be signed in to change notification settings - Fork 312
39 lines (34 loc) · 1.06 KB
/
check-merge-conflicts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Merge Conflict Checker
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
pull-requests: write
contents: read
jobs:
check_merge_conflicts:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check for merge conflicts
run: |
git fetch origin
if git merge-base --is-ancestor HEAD origin/main; then
echo "No merge conflicts."
else
echo "Merge conflicts detected."
exit 1
fi
continue-on-error: true
- name: Post comment if there are merge conflicts
if: failure()
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ This branch has conflicts that must be resolved. Please resolve the merge conflicts before proceeding.'
})