File tree 4 files changed +31
-8
lines changed
4 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ Available version are from 5 to 9.\
37
37
Default: 9\
38
38
Example: 9
39
39
40
+ ### ` style `
41
+
42
+ Style to use.\
43
+ Results in the appropriate --style parameter.\
44
+ Default: file\
45
+ Example: chromium
46
+
40
47
## Example usage
41
48
42
49
``` yml
53
60
- uses : DoozyX/clang-format-lint-action@v0.5
54
61
with :
55
62
source : ' .'
56
- exclude : ' ./third_party'
63
+ exclude : ' ./third_party ./external '
57
64
extensions : ' h,cpp'
58
65
clangFormatVersion : 9
66
+ style : chromium
59
67
` ` `
Original file line number Diff line number Diff line change @@ -21,11 +21,17 @@ inputs:
21
21
description : ' Version of clang-format'
22
22
required : false
23
23
default : ' 9'
24
+ style :
25
+ description : ' Formatting style to use'
26
+ required : false
27
+ default : ' file'
24
28
runs :
25
29
using : ' docker'
26
- image : ' docker://doozy/clang-format-lint:0.5 '
30
+ image : ' Dockerfile '
27
31
args :
32
+ - --clang-format-executable /clang-format/clang-format${{ inputs.clangFormatVersion }}
33
+ - -r
34
+ - --style ${{ inputs.style }}
35
+ - --extensions ${{ inputs.extensions }}
36
+ - --exclude ${{ inputs.exclude }}
28
37
- ${{ inputs.source }}
29
- - ${{ inputs.exclude }}
30
- - ${{ inputs.extensions }}
31
- - ${{ inputs.clangFormatVersion }}
Original file line number Diff line number Diff line change 2
2
3
3
cd " $GITHUB_WORKSPACE "
4
4
5
- ln -s /clang-format/clang-format${INPUT_CLANGFORMATVERSION} /usr/bin/clang-format
6
- /run-clang-format.py -r --exclude ${INPUT_EXCLUDE} --extensions ${INPUT_EXTENSIONS} ${INPUT_SOURCE}
5
+ /run-clang-format.py $*
Original file line number Diff line number Diff line change @@ -131,6 +131,8 @@ def run_clang_format_diff(args, file):
131
131
except IOError as exc :
132
132
raise DiffError (str (exc ))
133
133
invocation = [args .clang_format_executable , file ]
134
+ if args .style :
135
+ invocation .append ('-style=' + args .style )
134
136
135
137
# Use of utf-8 to decode the process output.
136
138
#
@@ -278,6 +280,10 @@ def main():
278
280
default = [],
279
281
help = 'exclude paths matching the given glob-like pattern(s)'
280
282
' from recursive search' )
283
+ parser .add_argument (
284
+ '--style' ,
285
+ help = 'Formatting style to use (default: file)' ,
286
+ default = 'file' )
281
287
282
288
args = parser .parse_args ()
283
289
@@ -329,7 +335,11 @@ def main():
329
335
extensions = args .extensions .split (',' ))
330
336
331
337
if not files :
332
- return
338
+ print_trouble (parser .prog , 'No files found' , use_colors = colored_stderr )
339
+ return ExitStatus .TROUBLE
340
+
341
+ if not args .quiet :
342
+ print ('Processing %s files: %s' % (len (files ), ', ' .join (files )))
333
343
334
344
njobs = args .j
335
345
if njobs == 0 :
You can’t perform that action at this time.
0 commit comments