diff options
author | FintasticMan <52415484+FintasticMan@users.noreply.github.com> | 2022-06-11 21:45:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-11 22:45:11 +0300 |
commit | a1385cb481de42028af0a3eb6eb26f51b2911410 (patch) | |
tree | bef447b654f894cf9786a3d64d1e11686be36a5f | |
parent | de62620de1a88fdbaafb56ebdfada37b4bf1c54c (diff) |
Minor changes to clang-format workflow (#1177)
-rw-r--r-- | .github/workflows/format.yml | 3 | ||||
-rwxr-xr-x | tests/test-format.sh | 13 |
2 files changed, 7 insertions, 9 deletions
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 9ebacc03..dc850096 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -7,6 +7,7 @@ on: - '**.cpp' - '**.h' - '!src/libs/**' + - '!src/FreeRTOS/**' jobs: test-format: @@ -18,8 +19,6 @@ jobs: - name: Configure git run: | - git config --global user.email "-" - git config --global user.name "Autoformatter" git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF" --depth=1000 - name: Install clang-format diff --git a/tests/test-format.sh b/tests/test-format.sh index 86667c75..fd3201d0 100755 --- a/tests/test-format.sh +++ b/tests/test-format.sh @@ -16,18 +16,17 @@ for file in $CHANGED_FILES do [ -e "$file" ] || continue case "$file" in - src/libs/*) continue ;; + src/libs/*|src/FreeRTOS/*) continue ;; *.cpp|*.h) echo Checking "$file" - clang-format -i "$file" - if ! git diff --quiet + PATCH="$(basename "$file").patch" + git clang-format-12 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH" + if [ -s "$PATCH" ] then printf "\033[31mError:\033[0m Formatting error in %s\n" "$file" CHANGED=1 - git add "$file" - git commit -q -m "Apply clang-format to $(basename "$file")" - printf "Creating patch " - git format-patch HEAD~ + else + rm "$PATCH" fi esac done |