-
Notifications
You must be signed in to change notification settings - Fork 16
45 lines (44 loc) · 1.37 KB
/
automerge.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
name: automerge
on:
pull_request_target:
types: [opened, edited]
paths-ignore: ['.github/**/*', '.github']
jobs:
checkEdits:
runs-on: ubuntu-latest
steps:
- name: Checkout pull request branch on forked repo
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
token: ${{ github.token }}
- name: Check for blacklisted edits
run: |
#!/bin/bash
head=$(git rev-parse --abbrev-ref HEAD)
echo - head: $head
main=$(git merge-base $head origin/main)
echo - main: $main
diff_cmd="git diff --name-only $head $main"
echo - diff_cmd: $diff_cmd
diffs=$($diff_cmd)
echo '- diff_cmd result (below):'
echo $diffs
echo '- forbidden edits (below):'
if grep -i '\.github' <<<$diffs; then
exit 1;
else
exit 0;
fi
automerge: # https://github.com/marketplace/actions/merge-pull-requests-automerge-action
needs: checkEdits
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: ""
MERGE_DELETE_BRANCH: true