You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- incorrect CI workflow names
- clarifications on compatibility guarantees
- nicer formatting for warnings
- version reference updates
- search link update
- links to regex101 example
The GitHub Actions [Test workflow](https://github.com/jidicula/clang-format-action/actions/workflows/test.yml) is triggered on PR submission. It runs [`test/test.sh`](https://github.com/jidicula/clang-format-action/blob/main/test/test.sh) on the [test files](https://github.com/jidicula/clang-format-action/tree/main/test). Run this script locally to test your changes. If you're adding checking functionality for new file extensions, add test files that are known to pass this Action's check and known to fail this Action's check, in `test/known_pass` and `test/known_fail` respectively.
3
+
The GitHub Actions [Tests workflow](https://github.com/jidicula/clang-format-action/actions/workflows/tests.yml) is triggered on PR submission. It runs [`test/test.sh`](https://github.com/jidicula/clang-format-action/blob/main/test/test.sh) on the [test files](https://github.com/jidicula/clang-format-action/tree/main/test). Run this script locally to test your changes. If you're adding checking functionality for new file extensions, add test files that are known to pass this action's check and known to fail this action's check, in `test/known_pass` and `test/known_fail` respectively.
Copy file name to clipboardExpand all lines: README.md
+23-14Lines changed: 23 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@
4
4
5
5
6
6
# clang-format-action
7
-
GitHub Action for `clang-format` checks. Note that this Action does **NOT** format your code for you - it only verifies that your repository's code follows your project's formatting conventions.
7
+
An action for `clang-format` checks. This action does **NOT** format your code for you - it only verifies that your repository's code follows your project's formatting conventions.
8
8
9
-
You can define your own formatting rules in a `.clang-format` file at your repository root, or you can provide a fallback style (see [`fallback-style`](#inputs)). You can also provide a path to check. If you want to run checks against multiple paths in your repository, you can use this Action in a [matrix run](#multiple-paths).
9
+
You can define your own formatting rules in a `.clang-format` file at your repository root, or you can provide a fallback style (see [`fallback-style`](#inputs)). You can also provide a path to check. If you want to run checks against multiple paths in your repository, you can use this action in a [matrix run](#multiple-paths).
10
10
11
11
## Major versions supported
12
12
* 3: `clang-format-3.9`
@@ -17,7 +17,7 @@ You can define your own formatting rules in a `.clang-format` file at your repos
17
17
* 8: `clang-format-8`
18
18
* 9: `clang-format-9`
19
19
* 10: `clang-format-10`
20
-
* 11: `clang-format-11`
20
+
* 11: `clang-format-11`
21
21
* 12: `clang-format-12`
22
22
* 13: `clang-format-13`
23
23
* 14: `clang-format-14`
@@ -26,6 +26,14 @@ You can define your own formatting rules in a `.clang-format` file at your repos
26
26
* 17: `clang-format-17`
27
27
* 18: `clang-format-18`
28
28
29
+
## Action version upgrade guarantee
30
+
31
+
> [!IMPORTANT]
32
+
> This action complies with the [Semantic Versioning spec](https://semver.org) for how it's called from GitHub Actions workflows. This means that for version format `x.y.z`, minor and patch version increments `y++` and `z++` will not break existing functionality for how this action is called in your GitHub Actions workflows. Major version increments (`x++`) *will* include breaking changes in how this action is called. If you notice version changes that violate this guarantee, [open an issue](https://github.com/jidicula/clang-format-action/issues/new?template=Blank+issue) and let's work together to fix it 😁.
33
+
34
+
> [!CAUTION]
35
+
> I provide no guarantees for formatting breakages *within*`clang-format` versions. This action only supports major versions of `clang-format` and doesn't support granular specification of `clang-format` minor or patch versions. It's possible that a formatting check workflow using this action and a pinned version of `clang-format` could break in a subsequent run if the underlying `clang-format` Ubuntu package has introduced a breaking minor or patch version change. I'm not sure how often this happens - vote in [this poll](https://github.com/jidicula/clang-format-action/discussions/192) and optionally leave a comment so I can understand this problem more.
36
+
29
37
## Do you find this useful?
30
38
31
39
You can sponsor me [here](https://github.com/sponsors/jidicula)!
@@ -42,10 +50,10 @@ You can sponsor me [here](https://github.com/sponsors/jidicula)!
42
50
* Available values: `LLVM`, `Google`, `Chromium`, `Mozilla`, `WebKit` and others listed in the `clang-format`[docs for BasedOnStyle](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options).
43
51
*`exclude-regex`[optional]: A regex to exclude files or directories that should not be checked.
44
52
* Default: `^$`
45
-
* Pattern matching is done with a POSIX `grep -E` extended regex, **not** a glob expression. You can exclude multiple patterns like this: `(hello|world)`. Build and verify your regex at https://regex101.com.
53
+
* Pattern matching is done with a POSIX `grep -E` extended regex, **not** a glob expression. You can exclude multiple patterns like this: `(hello|world)`. Build and verify your regex at [regex101.com](https://regex101.com) ([example](https://regex101.com/r/llFcLy/7)).
46
54
*`include-regex`[optional]: A regex to include files or directories that should be checked.
* Pattern matching is done with a POSIX `grep -E` extended regex, **not** a glob expression. You can exclude multiple patterns like this: `(hello|world)`. Build and verify your regex at https://regex101.com.
55
+
* Default: see [`INCLUDE_REGEX`](./check.sh#77)
56
+
* Pattern matching is done with a POSIX `grep -E` extended regex, **not** a glob expression. You can exclude multiple patterns like this: `(hello|world)`. Build and verify your regex at [regex101.com](https://regex101.com) ([example](https://regex101.com/r/llFcLy/7)).
49
57
50
58
This action checks all C/C++/Protobuf (including Arduino `.ino` and `.pde`) files in the provided directory in the GitHub workspace are formatted correctly using `clang-format`. If no directory is provided or the provided path is not a directory in the GitHub workspace, all C/C++/Protobuf files are checked.
51
59
@@ -77,7 +85,8 @@ The following file extensions are checked by default:
77
85
78
86
# Usage
79
87
80
-
⚠️This action does not run on `windows` GitHub Actions runners!
88
+
> [!WARNING]
89
+
> This action is not supported on `windows` GitHub Actions runners!
81
90
82
91
## Single Path
83
92
@@ -91,9 +100,9 @@ jobs:
91
100
name: Formatting Check
92
101
runs-on: ubuntu-latest
93
102
steps:
94
-
- uses: actions/checkout@v3
103
+
- uses: actions/checkout@v4
95
104
- name: Run clang-format style check for C/C++/Protobuf programs.
96
-
uses: jidicula/clang-format-action@v4.11.0
105
+
uses: jidicula/clang-format-action@v4.12.0
97
106
with:
98
107
clang-format-version: '13'
99
108
check-path: 'src'
@@ -116,9 +125,9 @@ jobs:
116
125
- 'src'
117
126
- 'examples'
118
127
steps:
119
-
- uses: actions/checkout@v3
128
+
- uses: actions/checkout@v4
120
129
- name: Run clang-format style check for C/C++/Protobuf programs.
121
-
uses: jidicula/clang-format-action@v4.11.0
130
+
uses: jidicula/clang-format-action@v4.12.0
122
131
with:
123
132
clang-format-version: '13'
124
133
check-path: ${{ matrix.path }}
@@ -143,9 +152,9 @@ jobs:
143
152
- check: 'examples'
144
153
exclude: '' # Nothing to exclude
145
154
steps:
146
-
- uses: actions/checkout@v3
155
+
- uses: actions/checkout@v4
147
156
- name: Run clang-format style check for C/C++/Protobuf programs.
148
-
uses: jidicula/clang-format-action@v4.11.0
157
+
uses: jidicula/clang-format-action@v4.12.0
149
158
with:
150
159
clang-format-version: '13'
151
160
check-path: ${{ matrix.path['check'] }}
@@ -155,4 +164,4 @@ jobs:
155
164
156
165
# Who uses this?
157
166
158
-
[These public repos](https://github.com/search?o=desc&q=uses%3A+jidicula%2Fclang-format-action+-user%3Ajidicula&s=indexed&type=Code) use this Action.
167
+
[These public repos](https://github.com/search?q=%22uses%3A+jidicula%2Fclang-format-action%22+-user%3Ajidicula&type=code) use this Action.
0 commit comments