@cryptotaxi247 / netdata-1 / commits / 61925baaf

Fix regex syntax for clang-format checks. (#14871)

* Fix regex syntax for clang-format checks. This will ensure they only run when needed, and only on the files they should be run on. * Apply suggestions from code review Co-authored-by: Tasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com> --------- Co-authored-by: Tasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com>

Austin S. Hemmelgarn committed Apr 7, 2023 at 10:03 UTC 61925baaf6e2448c641e8e71248a47f7a01c4efd
1 file changed +2 -2
.github/workflows/review.yml
+2 -2
@@ -43,7 +43,7 @@ jobs:
43 run: |
44 if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/clang-format') }}" = "true" ]; then
45 echo "run=true" >> "${GITHUB_OUTPUT}"
46 - elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.\(cpp|cxx|c|hpp|hxx|h\)$' ; then
46 + elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '\.cpp$|\.cxx$|\.c$|\.hpp$|\.hxx$|\.h$' ; then
47 echo "run=true" >> "${GITHUB_OUTPUT}"
48 echo 'C/C++ code has changed, need to run clang-format.'
49 else
@@ -146,7 +146,7 @@ jobs:
146 if [ "${{ steps.label.outputs.check-all }}" == 'true' ]; then
147 find . -regex '.*\.\(c\|cpp\|cxx\|h\|hpp\|hxx\)$' -exec clang-format -i --style=file '{}' \;
148 else
149 - git diff --name-only origin/${{ github.base_ref }} HEAD | grep -E '.*\.\(cpp|cxx|c|hpp|hxx|h\)$' | \
149 + git diff --name-only origin/${{ github.base_ref }} HEAD | grep -E '\.cpp$|\.cxx$|\.c$|\.hpp$|\.hxx$|\.h$' | \
150 xargs -n 1 -r clang-format -i --style=file
151 fi
152 git status --porcelain=v1 > /tmp/porcelain