-
Notifications
You must be signed in to change notification settings - Fork 370
49 lines (42 loc) · 1.31 KB
/
Copy pathclang-format.yml
File metadata and controls
49 lines (42 loc) · 1.31 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Clang Format Check
on:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- 'docs/**'
workflow_dispatch:
jobs:
clang-format:
if: github.repository == 'MrNeRF/LichtFeld-Studio'
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Print clang-format version
run: clang-format --version
- name: Run clang-format
run: |
find . -regex '.*\.\(cpp\|hpp\|cc\|c\|h\|cu\|cuh\)' \
-exec clang-format -i {} +
- name: Commit and push changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}
git add .
git commit -m "style: apply clang-format"
git push
else
echo "No formatting changes needed."
fi