-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (28 loc) · 960 Bytes
/
format.yaml
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: Format Files
on:
push:
branches:
- main
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Clang tools
run: |
sudo apt-get update
sudo apt-get install -y clang-format clang-tidy
- name: Format files
run: |
git diff --name-only --diff-filter=d origin/main...HEAD | xargs clang-format -i -style=file src/*.c
git diff --name-only --diff-filter=d origin/main...HEAD | xargs clang-tidy -fix --config-file=.clang-tidy src/*.c
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Apply code formatting" --no-verify --amend
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}