-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 845 Bytes
/
clang-format.yml
File metadata and controls
35 lines (30 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: clang-format
on:
pull_request:
branches: [ "main" ]
push:
branches-ignore:
- main
jobs:
format:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y clang-format
- name: Run clang-format
run: |
clang-format -i $(git ls-files '*.cpp' '*.hpp' '*.h' '*.c')
- name: Commit and push changes
run: |
if ! git diff --quiet; then
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
git commit -am "Apply clang-format"
git push
fi