Skip to content

Commit 08c604b

Browse files
committed
chore: add check_code_format.yml
1 parent 5d3d7d4 commit 08c604b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: check_code_format
3+
4+
'on':
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
11+
jobs:
12+
check_format_code:
13+
name: check format code
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install fprettify
19+
run: pip install fprettify
20+
21+
- name: Display fprettify version
22+
run: fprettify --version
23+
24+
- name: Format code
25+
run: |
26+
git clean -f -x -d
27+
fprettify --indent 4 --recursive .
28+
29+
- name: Fail if needs reformatting
30+
run: |
31+
if [[ $(git status --porcelain) ]]; then
32+
echo "please reformat/fprettify these files:"
33+
git status --porcelain=v1
34+
exit 1
35+
fi
36+
...

0 commit comments

Comments
 (0)