forked from opencurve/curve
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: peter <[email protected]> Signed-off-by: Hanqing Wu <[email protected]>
- Loading branch information
1 parent
6f5c85b
commit f6b285d
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Code Fomatter | ||
|
||
# run on pull requests to develop | ||
on: | ||
pull_request | ||
|
||
jobs: | ||
format: | ||
name: Clang Formatter | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
# fetch everything to be able to compare with any ref | ||
fetch-depth: 0 | ||
|
||
- name: Check | ||
env: | ||
LANG: "C.UTF-8" | ||
LC_ALL: "C.UTF-8" | ||
LANGUAGE: "C.UTF-8" | ||
run: | | ||
sudo apt install -y clang-format-15 python3 git | ||
diff_output_file=$(mktemp) | ||
git --no-pager diff -U0 --diff-filter=ACMRT ${{github.event.pull_request.base.sha}} ${{ github.event.pull_request.head.sha }} | clang-format-diff-15 -p1 2>&1 | tee $diff_output_file | ||
if [ -s $diff_output_file ]; then | ||
exit 1 | ||
else | ||
exit 0 | ||
fi | ||