Skip to content

Commit e491da0

Browse files
committed
Add GitHub Action to enforce clang-format on push/PR
1 parent ad2fc82 commit e491da0

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/clang-format.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: clang-format
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.cpp'
7+
- '**.hpp'
8+
push:
9+
branches:
10+
- master
11+
12+
jobs:
13+
format-check:
14+
name: Check clang-format
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Install clang-format
22+
run: sudo apt install -y clang-format
23+
24+
- name: Run clang-format check
25+
run: |
26+
FILES=$(find . \( -name '*.cpp' -o -name '*.hpp' \) -not -path "./build/*")
27+
clang-format --dry-run --Werror $FILES

0 commit comments

Comments
 (0)