-
Notifications
You must be signed in to change notification settings - Fork 45
66 lines (52 loc) · 1.64 KB
/
tribits_lint.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
60
61
62
63
64
65
66
name: TriBITS Lint
on:
pull_request:
branches: [ master ]
jobs:
codespell-source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Print GitHub Actions Environment Variables
run: |
set | grep "^GITHUB_"
- name: Update OS
run: |
sudo apt-get update -y
- name: Install packages
run: |
sudo apt-get install -y codespell
- name: Run Codespell on source code
run: |
codespell
codespell-commit-messages:
runs-on: ubuntu-latest
if: github.event.pull_request != null
steps:
- name: PR commits + 1
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
- name: Checkout PR branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Fetch base ref
run: |
git fetch origin ${{ github.event.pull_request.base.sha }}
- name: Print GitHub Actions Environment Variables
run: |
set | grep "^GITHUB_"
- name: Update OS
run: |
sudo apt-get update -y
- name: Install packages
run: |
sudo apt-get install -y codespell
- name: Run Codespell on commit messages
run: |
result=0
for commit in $(git rev-list HEAD ^${{ github.event.pull_request.base.sha }}); do
echo "Running codespell on commit message of $commit..."
git show --format=%B -s "$commit" | codespell - || result=1
done
exit $result