-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (25 loc) · 967 Bytes
/
formatter.yml
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
name: Auto Format
on: push
jobs:
run:
name: Format with clang-format
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Execute formatter
run: |
export CPP_SRC_FILES=$(find ./lib -name "*.*" | grep -E "(\.cc$|\.cpp$|\.h$|\.hpp$)")
export CPP_SRC_FILES="$CPP_SRC_FILES $(find ./app -name "*.*" | grep -E "(\.cc$|\.cpp$|\.h$|\.hpp$)")"
export CPP_SRC_FILES="$CPP_SRC_FILES $(find ./test -name "*.*" | grep -E "(\.cc$|\.cpp$|\.h$|\.hpp$)")"
if [ -n "$CPP_SRC_FILES" ]; then clang-format --style=Google -i $CPP_SRC_FILES; fi;
- name: Commit changes
uses: Endbug/add-and-commit@v9
with:
default_author: github_actions
message: 'Auto Format'
add: '*.*'