Skip to content

Commit 225051f

Browse files
authored
Update detect-merge-conflicts.yaml
1 parent 88d7d79 commit 225051f

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed
Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
1-
name: "Detect Merge Conflicts"
1+
name: Detect Merge Conflicts
2+
23
on:
3-
workflow_dispatch:
44
pull_request:
55
branches:
6-
- dev
7-
- master
8-
- bugfix
9-
- release/*
10-
11-
pull_request_target:
12-
types: [synchronize]
6+
- main
7+
8+
permissions:
9+
contents: read # Чтение содержимого репозитория
10+
pull-requests: write # Запись в pull request для добавления комментариев
1311

1412
jobs:
15-
main:
13+
detect-conflicts:
1614
runs-on: ubuntu-latest
15+
1716
steps:
18-
- name: check if prs are conflicted
19-
uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3.0.3
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Check for merge conflicts
21+
run: |
22+
if git merge-base --is-ancestor main HEAD; then
23+
echo "No merge conflicts detected."
24+
else
25+
echo "Merge conflicts detected!"
26+
exit 1
27+
fi
28+
29+
- name: Comment on PR if conflicts found
30+
if: failure()
31+
uses: thollander/actions-comment-pull-request@v1
2032
with:
21-
dirtyLabel: "conflicts-detected"
22-
repoToken: "${{ secrets.GITHUB_TOKEN }}"
23-
commentOnDirty: "This pull request has conflicts, please resolve those before we can evaluate the pull request."
24-
commentOnClean: "Conflicts have been resolved. A maintainer will review the pull request shortly."
33+
message: "Merge conflicts have been detected. Please resolve them before merging this PR."
34+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)