File tree Expand file tree Collapse file tree 2 files changed +18
-25
lines changed Expand file tree Collapse file tree 2 files changed +18
-25
lines changed Original file line number Diff line number Diff line change 6767 - name : Run formatting style check
6868 run : |
6969 clang-format-18 --version
70- CLANG_FORMAT=clang-format-18 scripts/run-clang-format.sh
71- git diff > /tmp/format-diff
72- if [ -s "/tmp/format-diff" ]; then
73- echo "Difference to optimal formatting"
74- cat /tmp/format-diff
75- echo
76- echo "=================== To Fix ==========================="
77- echo "Run scripts/run-format.sh"
78- echo "then"
79- echo " git commit -a --amend"
80- echo " git push -f"
81- exit 1
82- fi
70+ RUNNING_IN_CI=1 CLANG_FORMAT=clang-format-18 \
71+ scripts/run-clang-format.sh
8372
8473 ClangTidy :
8574 runs-on : ubuntu-24.04
@@ -117,4 +106,3 @@ jobs:
117106 clang-tidy-18 --version
118107 CLANG_TIDY=clang-tidy-18 scripts/run-clang-tidy-cached.cc \
119108 || ( cat fpga-assembler_clang-tidy.out ; exit 1)
120-
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ FORMAT_OUT=${TMPDIR:-/tmp}/clang-format-diff.out
66
77CLANG_FORMAT=${CLANG_FORMAT:- clang-format}
88BUILDIFIER=${BUILDIFIER:- buildifier}
9+ RUNNING_IN_CI=${RUNNING_IN_CI:- 0}
910
1011${CLANG_FORMAT} --version
1112
@@ -19,17 +20,21 @@ if command -v ${BUILDIFIER} >/dev/null; then
1920 ${BUILDIFIER} -lint=fix MODULE.bazel $( find . -name BUILD -o -name " *.bzl" )
2021fi
2122
22- # Check if we got any diff
23- git diff > ${FORMAT_OUT}
24-
25- if [ -s ${FORMAT_OUT} ]; then
26- echo " Style not matching"
27- echo " Run"
28- echo " .github/bin/run-clang-format.sh"
29- echo " -------------------------------------------------"
30- echo
31- cat ${FORMAT_OUT}
32- exit 1
23+ # If in CI, we want to report changes, as we don't expect them
24+ if [ " $RUNNING_IN_CI " -eq 1 ]; then
25+ # Check if we got any diff
26+ git diff > ${FORMAT_OUT}
27+
28+ if [ -s ${FORMAT_OUT} ]; then
29+ echo " Style not matching"
30+ echo " Run"
31+ echo " scripts/run-clang-format.sh"
32+ echo " and amend PR."
33+ echo " -------------------------------------------------"
34+ echo
35+ cat ${FORMAT_OUT}
36+ exit 1
37+ fi
3338fi
3439
3540exit 0
You can’t perform that action at this time.
0 commit comments