forked from ss220-space/Paradise
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (44 loc) · 1.49 KB
/
label_testmerge_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
40
41
42
43
44
45
46
name: 'Testmerge Conflict Detection'
on:
push:
branches:
- testmerge
pull_request_target:
types: [ready_for_review, opened, synchronize, reopened]
jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: testmerge
- name: Check for testmerge conflicts
id: check
run: |
git config --local user.email "[email protected]"
git config --local user.name "Testmerge Conflict Detection"
git fetch origin pull/${{ github.event.number }}/head:PR${{ github.event.number }}
git merge --no-commit --no-ff PR${{ github.event.number }} || true
CONFLICTS=$(git ls-files -u | wc -l)
if [ "$CONFLICTS" -gt 0 ] ; then
echo "There is a merge conflict. Aborting"
git merge --abort
echo "success=0" >> $GITHUB_OUTPUT
exit 0
fi
echo "success=1" >> $GITHUB_OUTPUT
- name: Label PR
uses: jburgess/[email protected]
if: steps.check.outputs.success == 0
with:
githubToken: '${{ secrets.GITHUB_TOKEN }}'
labelsToAdd: 'Testmerge Conflict'
- name: Unlabel PR
uses: jburgess/[email protected]
if: steps.check.outputs.success == 1
with:
githubToken: '${{ secrets.GITHUB_TOKEN }}'
labelsToRemove: 'Testmerge Conflict'