-
Notifications
You must be signed in to change notification settings - Fork 7
42 lines (37 loc) · 1.27 KB
/
auto_approve.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
name: Auto Pull Request Approval
on:
pull_request:
types: [opened, synchronize]
paths:
- 'modifier/**'
- 'data/**'
- 'changelogs/**'
jobs:
auto-approve-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check username
id: check_user
run: |
AUTHOR="${{ github.event.pull_request.user.login }}"
ALLOWED_USERS="EternityTQ, Cre-epbee, QueenOfDemons"
if [[ $ALLOWED_USERS =~ (^|[[:space:]])$AUTHOR($|[[:space:]]) ]]; then
echo "::set-output name=allowed::true"
else
echo "::set-output name=allowed::false"
fi
- name: Auto approve pull request
if: steps.check_user.outputs.allowed == 'true'
run: |
curl -X POST -H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \
-d '{"event":"APPROVE"}'
- name: Push changes
run: |
git config --global user.name 'Your Name'
git config --global user.email '[email protected]'
git commit --allow-empty -m 'Trigger Push'
git push