Skip to content

Commit a1385cb

Browse files
authored
Minor changes to clang-format workflow (#1177)
1 parent de62620 commit a1385cb

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

.github/workflows/format.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- '**.cpp'
88
- '**.h'
99
- '!src/libs/**'
10+
- '!src/FreeRTOS/**'
1011

1112
jobs:
1213
test-format:
@@ -18,8 +19,6 @@ jobs:
1819

1920
- name: Configure git
2021
run: |
21-
git config --global user.email "-"
22-
git config --global user.name "Autoformatter"
2322
git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF" --depth=1000
2423
2524
- name: Install clang-format

tests/test-format.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,17 @@ for file in $CHANGED_FILES
1616
do
1717
[ -e "$file" ] || continue
1818
case "$file" in
19-
src/libs/*) continue ;;
19+
src/libs/*|src/FreeRTOS/*) continue ;;
2020
*.cpp|*.h)
2121
echo Checking "$file"
22-
clang-format -i "$file"
23-
if ! git diff --quiet
22+
PATCH="$(basename "$file").patch"
23+
git clang-format-12 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH"
24+
if [ -s "$PATCH" ]
2425
then
2526
printf "\033[31mError:\033[0m Formatting error in %s\n" "$file"
2627
CHANGED=1
27-
git add "$file"
28-
git commit -q -m "Apply clang-format to $(basename "$file")"
29-
printf "Creating patch "
30-
git format-patch HEAD~
28+
else
29+
rm "$PATCH"
3130
fi
3231
esac
3332
done

0 commit comments

Comments
 (0)