File tree Expand file tree Collapse file tree 1 file changed +54
-11
lines changed
Expand file tree Collapse file tree 1 file changed +54
-11
lines changed Original file line number Diff line number Diff line change 11name : Verify code formatting
2+
23on :
34 push :
5+ branches : [ "main" ]
46 pull_request :
7+ branches : [ "main" ]
8+ workflow_dispatch :
59
610jobs :
711 verify-formatting :
8- if : ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
9- runs-on : ubuntu-22.04
12+ runs-on : ubuntu-latest
1013 steps :
1114 - name : Checkout
1215 uses : actions/checkout@v4
1316 with :
1417 persist-credentials : false
1518 fetch-depth : 0
16- - name : Checkout astyle
17- uses : actions/checkout@v4
18- with :
19- repository : szepeviktor/astyle
20- path : astyle
21- ref : v3.4.12
2219 - name : Install astyle
20+ run : sudo apt-get update && sudo apt-get install -y astyle
21+ - name : Run astyle check
2322 run : |
24- cd astyle/build/gcc/
25- make
26- sudo make install
23+ # Run astyle but don't overwrite
2724 astyle --version
25+ if astyle --style=allman \
26+ --indent=spaces=4 \
27+ --indent-col1-comments \
28+ --pad-oper \
29+ --pad-comma \
30+ --pad-header \
31+ --unpad-paren \
32+ --align-pointer=name \
33+ --align-reference=name \
34+ --break-closing-braces \
35+ --add-braces \
36+ --attach-return-type \
37+ --attach-return-type-decl \
38+ --convert-tabs \
39+ --indent-cases \
40+ --indent-namespaces \
41+ --indent-preproc-define \
42+ --recursive \
43+ --dry-run \
44+ "*.cpp" "*.h" "*.ino" | grep -q "Formatted"; then
45+ echo "::error::Indentation check failed"
46+ astyle --style=allman \
47+ --indent=spaces=4 \
48+ --indent-col1-comments \
49+ --pad-oper \
50+ --pad-comma \
51+ --pad-header \
52+ --unpad-paren \
53+ --align-pointer=name \
54+ --align-reference=name \
55+ --break-closing-braces \
56+ --add-braces \
57+ --attach-return-type \
58+ --attach-return-type-decl \
59+ --convert-tabs \
60+ --indent-cases \
61+ --indent-namespaces \
62+ --indent-preproc-define \
63+ --recursive \
64+ --dry-run \
65+ --formatted \
66+ "*.cpp" "*.h" "*.ino"
67+ exit 1
68+ else
69+ echo "Indentation check passed"
70+ fi
You can’t perform that action at this time.
0 commit comments