-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
54 lines (45 loc) · 1.32 KB
/
commit_validation.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
name: Commit Validation
on:
pull_request:
permissions: read-all
jobs:
commit_validation:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: jitterbit/get-changed-files@v1
id: abc
with:
format: space-delimited
token: ${{ secrets.GITHUB_TOKEN }}
# Checkout the repo
- uses: actions/checkout@v3
with:
fetch-depth: 0 # needed to checkout all branches for this Action to work
# Check the PR diff using the current branch and the base branch of the PR
- uses: GrantBirki/[email protected]
id: git-diff-action
with:
json_diff_file_output: diff.json
raw_diff_file_output: diff.txt
# Print the diff in JSON format
- name: Check commits for validity
id: validation
env:
DIFF: ${{ steps.git-diff-action.outputs.json-diff-path }}
run: |
pip install -r requirements.txt
python validate_commit.py $DIFF
upload:
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number.txt
path: pr/