File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ name : ' Format code on pull request'
2+
3+ on :
4+ pull_request :
5+ branches-ignore :
6+ - Master
7+ paths :
8+ - ' **.c'
9+ - ' **.h'
10+
11+ jobs :
12+ clang-format :
13+ name : Format code
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v4
18+ with :
19+ ref : ${{github.head_ref}}
20+
21+ - name : Install clang-format (formatter tool)
22+ run : sudo apt-get install clang-format
23+
24+ - name : Run clang-format
25+ run : find . -name '*.c' -o -name '*.h' | xargs clang-format -i -style=file
26+
27+ - name : Commit changes
28+ run : |
29+ git config --global user.name 'github-actions[bot]'
30+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
31+ git add .
32+ git diff-index --quiet HEAD || git commit -m "ci: format code"
33+
34+ - name : Push changes
35+ 36+ with :
37+ branch : ${{ github.head_ref }}
38+ github_token : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments