generated from ut-issl/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 18
49 lines (41 loc) · 1.14 KB
/
check-format.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: check format
on:
push:
branches:
- main
- develop
pull_request:
paths:
- '.github/workflows/check-format.yml'
- '.clang-format'
- 'src/**'
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
clang-format --version
- name: check clang-format version
run: |
clang-format --version
md5sum "$(which git-clang-format)"
head "$(which git-clang-format)"
- name: check format(push)
if: github.event_name == 'push'
run: |
git-clang-format --commit HEAD^ --diff | tee format.patch
- name: check format(pull_request)
if: github.event_name == 'pull_request'
run: |
git-clang-format --commit ${{ github.event.pull_request.base.sha }} --diff | tee format.patch
- name: check
run: |
git apply --allow-empty format.patch
git status
git diff --exit-code