-
Notifications
You must be signed in to change notification settings - Fork 50
59 lines (45 loc) · 1.61 KB
/
check-commit.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
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Check Commit
on:
pull_request:
branches: [ main ]
jobs:
check-signed-off-by:
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'PR/NO TEST') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: refs/pull/${{ github.event.number }}/merge
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: npm install
- run: |
ROLL_BACK_COUNT=$(( ${{ github.event.pull_request.commits }} - 1 ))
git log --format=%B -n 1 ${{ github.event.pull_request.head.sha }}~${ROLL_BACK_COUNT} > main_commit_msg
- run: npx ts-node infra/commit/signed-off-by-checker.ts main_commit_msg
- if: ${{ hashFiles('signed_off_by_checker.fail') }}
run: |
cat signed_off_by_checker.fail
exit 1
check-no-body:
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'PR/NO TEST') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: refs/pull/${{ github.event.number }}/merge
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: npm install
- run: |
ROLL_BACK_COUNT=$(( ${{ github.event.pull_request.commits }} - 1 ))
git log --format=%B -n 1 ${{ github.event.pull_request.head.sha }}~${ROLL_BACK_COUNT} > main_commit_msg
- run: npx ts-node infra/commit/no-body-checker.ts main_commit_msg
- if: ${{ hashFiles('no_body_checker.fail') }}
run: |
cat no_body_checker.fail
exit 1