File tree Expand file tree Collapse file tree 2 files changed +26
-28
lines changed
Expand file tree Collapse file tree 2 files changed +26
-28
lines changed Original file line number Diff line number Diff line change 1+ name : Clang format
2+
3+ on : [pull_request]
4+
5+ jobs :
6+ clang-format-8 :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - uses : actions/checkout@v2
10+ with :
11+ ref : ${{ github.event.pull_request.head.sha }}
12+ - name : Run clang-foramt on changed files
13+ run : |
14+ set -x
15+ git fetch origin ${{ github.event.pull_request.base.ref }}
16+ git fetch origin pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
17+ 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+ if [ "$RESULT_OUTPUT" == "no modified files to format" ] || [ "$RESULT_OUTPUT" == "clang-format did not modify any files" ]; then
21+ exit 0
22+ else
23+ git-clang-format-8 --commit $BASE_COMMIT --diff --binary $(which clang-format-8)
24+ echo "$RESULT_OUTPUT"
25+ exit 1
26+ fi
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments