forked from Kagami/SVT-AV1
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (49 loc) · 1.68 KB
/
style-check.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
name: Style Check
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Tab check
if: always()
run: |
! git grep -InP --heading "\t" -- . ':!third_party/**/*'
- name: Carriage Return check
if: always()
run: |
! git grep -InP --heading "\r" -- . ':!third_party/**/*'
- name: Trailing spaces
if: always()
run: |
! git grep -InP --heading " $" -- . ':!third_party/**/*'
- name: Fetch upstream
if: always()
run: |
git fetch -q https://github.com/OpenVisualCloud/SVT-AV1.git master
- name: newline at EOF check
if: always()
run: |
for file in $(git diff --name-only --diff-filter=d FETCH_HEAD -- . ':!third_party' ':!test/e2e_test/test_vector_list.txt' ':!test/vectors/smoking_test.cfg' ':!test/vectors/video_src.cfg' ':!*.png'); do
if [ -n "$(tail -c1 "$file")" ]; then
echo "No newline at end of $file"
false
fi
done
- name: Check commit message
if: always()
run: |
for i in $(git rev-list HEAD ^FETCH_HEAD); do
echo "Checking commit message of $i"
msg="$(git log --format=%B -n 1 $i)"
if [ -n "$(sed -n 2p <<<"$msg")" ]; then
echo "Malformed commit message in $i, second line must be empty"
false
fi
if head -1 <<<"$msg" | grep -q '\.$'; then
echo "Malformed commit message in $i, trailing period in subject line"
false
fi
done