diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2023-04-07 10:03:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 10:03:20 -0400 |
commit | 61925baaf6e2448c641e8e71248a47f7a01c4efd (patch) | |
tree | 84fe20b9e82ec248b2c62dd7231e80c169e3e7df /.github | |
parent | ea5fbe8af084c154a6aa2f678570ec80c73356ea (diff) |
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>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/review.yml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 624ffb803c..3e015f11b1 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -43,7 +43,7 @@ jobs: run: | if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/clang-format') }}" = "true" ]; then echo "run=true" >> "${GITHUB_OUTPUT}" - elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.\(cpp|cxx|c|hpp|hxx|h\)$' ; then + elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '\.cpp$|\.cxx$|\.c$|\.hpp$|\.hxx$|\.h$' ; then echo "run=true" >> "${GITHUB_OUTPUT}" echo 'C/C++ code has changed, need to run clang-format.' else @@ -146,7 +146,7 @@ jobs: if [ "${{ steps.label.outputs.check-all }}" == 'true' ]; then find . -regex '.*\.\(c\|cpp\|cxx\|h\|hpp\|hxx\)$' -exec clang-format -i --style=file '{}' \; else - git diff --name-only origin/${{ github.base_ref }} HEAD | grep -E '.*\.\(cpp|cxx|c|hpp|hxx|h\)$' | \ + git diff --name-only origin/${{ github.base_ref }} HEAD | grep -E '\.cpp$|\.cxx$|\.c$|\.hpp$|\.hxx$|\.h$' | \ xargs -n 1 -r clang-format -i --style=file fi git status --porcelain=v1 > /tmp/porcelain |