File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -3,24 +3,26 @@ name: Clang format
33on : [pull_request]
44
55jobs :
6- clang-format-8 :
7- runs-on : ubuntu-latest
6+ clang-format :
7+ runs-on : ubuntu-24.04
88 steps :
9- - uses : actions/checkout@v2
9+ - uses : actions/checkout@v4
1010 with :
1111 ref : ${{ github.event.pull_request.head.sha }}
12- - name : Run clang-foramt on changed files
12+ - name : Run clang-format on changed files
1313 run : |
1414 set -x
15+ sudo apt install clang-format
16+ git config --global --add safe.directory '*'
1517 git fetch origin ${{ github.event.pull_request.base.ref }}
1618 git fetch origin pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
1719 BASE_COMMIT=$(git rev-parse ${{ github.event.pull_request.base.sha }})
18- COMMIT_FILES=$(git diff --name-only ${BASE_COMMIT} | grep -i -v LinkDef)
19- RESULT_OUTPUT=$(git- clang-format-8 --commit ${BASE_COMMIT} --diff --binary $(which clang-format-8) ${COMMIT_FILES})
20+ COMMIT_FILES=$(git diff --name-only " ${BASE_COMMIT}" | grep -i -v LinkDef)
21+ RESULT_OUTPUT=$(git clang-format --commit " ${BASE_COMMIT}" --diff --binary " $(which clang-format)" -- " ${COMMIT_FILES}" )
2022 if [ "$RESULT_OUTPUT" == "no modified files to format" ] || [ "$RESULT_OUTPUT" == "clang-format did not modify any files" ]; then
2123 exit 0
2224 else
23- git- clang-format-8 --commit $BASE_COMMIT --diff --binary $(which clang-format-8)
25+ git clang-format --commit " $BASE_COMMIT" --diff --binary " $(which clang-format)"
2426 echo "$RESULT_OUTPUT"
2527 exit 1
26- fi
28+ fi
You can’t perform that action at this time.
0 commit comments