Skip to content

Commit c41ce39

Browse files
authored
Merge pull request #2 from GOB52/clang-format-action
Raise checkout and clang-format-action version. Add execute conditions
2 parents 4ffc376 + 24f6bd6 commit c41ce39

File tree

1 file changed

+40
-12
lines changed

1 file changed

+40
-12
lines changed
Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
name: clang-format Check
2-
on: [push, pull_request]
2+
3+
env:
4+
INCLUDE_REGEX: ^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$))|(inl|ino|pde|proto|cu))$
5+
6+
on:
7+
push:
8+
paths:
9+
- '**.ino'
10+
- '**.cpp'
11+
- '**.hpp'
12+
- '**.h'
13+
- '**.c'
14+
- '**.inl'
15+
- '**clang-format-check.yml'
16+
pull_request:
17+
- '**.ino'
18+
- '**.cpp'
19+
- '**.hpp'
20+
- '**.h'
21+
- '**.c'
22+
- '**.inl'
23+
- '**clang-format-check.yml'
24+
325
jobs:
426
formatting-check:
527
name: Formatting Check
@@ -9,15 +31,21 @@ jobs:
931
path:
1032
- check: './' # path to include
1133
exclude: '' # path to exclude
12-
# - check: 'src'
13-
# exclude: '(Fonts)' # Exclude file paths containing "Fonts"
14-
# - check: 'examples'
15-
# exclude: ''
34+
#- check: 'src'
35+
# exclude: '(Fonts)' # Exclude file paths containing "Fonts"
36+
#- check: 'examples'
37+
# exclude: ''
38+
1639
steps:
17-
- uses: actions/[email protected]
18-
- name: Run clang-format style check for C/C++/Protobuf programs.
19-
uses: jidicula/[email protected]
20-
with:
21-
clang-format-version: '13'
22-
check-path: ${{ matrix.path['check'] }}
23-
exclude-regex: ${{ matrix.path['exclude'] }}
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
ref: ${{ github.event.pull_request.head.sha }}
44+
45+
- name: Run clang-format style check for C/C++/Protobuf programs.
46+
uses: jidicula/[email protected] # Using include-regex 10.x or later
47+
with:
48+
clang-format-version: '13'
49+
check-path: ${{ matrix.path['check'] }}
50+
exclude-regex: ${{ matrix.path['exclude'] }}
51+
include-regex: ${{ env.INCLUDE_REGEX }}

0 commit comments

Comments
 (0)