-
-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (60 loc) · 2.07 KB
/
procedure-pull-request.yaml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: (Procedure) Pull request
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check-code-update:
runs-on: ubuntu-20.04
outputs:
abort: ${{ steps.set-output.outputs.abort }}
steps:
- uses: actions/checkout@v3
with:
ref: master
- uses: actions/checkout@v3
- id: set-output
name: Check if the code or workflows has been changed.
run: |
if [ $(git --no-pager diff --name-only origin/master HEAD -- vkit | wc -l) -eq 0 ] \
&& [ $(git --no-pager diff origin/master HEAD -- setup.cfg | wc -l) -eq 0 ] \
&& [ $(git --no-pager diff --name-only origin/master HEAD -- .github | wc -l) -eq 0 ]
then
echo "abort=1" >> $GITHUB_OUTPUT
else
echo "abort=0" >> $GITHUB_OUTPUT
fi
call-workflow-type-checking:
uses: ./.github/workflows/workflow-type-checking.yaml
needs: check-code-update
if: needs.check-code-update.outputs.abort != 1
call-workflow-test:
uses: ./.github/workflows/workflow-test.yaml
needs: check-code-update
if: needs.check-code-update.outputs.abort != 1
signoff:
runs-on: ubuntu-20.04
needs: [check-code-update, call-workflow-type-checking, call-workflow-test]
if: ${{ always() }}
steps:
- name: Signoff based on the previous jobs.
run: |
if [ "${{ needs.check-code-update.outputs.abort }}" = "1" ] ; then
exit 0
else
if [ "${{ needs.call-workflow-type-checking.result }}" = "success" ] \
&& [ "${{ needs.call-workflow-test.result }}" = "success" ]
then
exit 0
else
exit 1
fi
fi
- name: Auto approve for the project owner
run: |
gh pr review ${{ github.event.number }} --approve
if: github.event.sender.login == 'huntzhan'
env:
GH_TOKEN: ${{ secrets.VKIT_X_BOT_PAT }}
GH_REPO: ${{ github.repository }}