diff --git a/ReadMe.md b/ReadMe.md index 631047d..468377e 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -12,7 +12,7 @@ An action that check code format using `clang-format` tool. Suitable for project ## Inputs ### `sources` -Sources to check by this action. It can be a single file, regex of a folder or multiple selecteor seprated by comma (`,`). +Sources to check by this action. It can be a single file, regex of a folder or multiple selectors separated by comma (`,`). Default: `"**/*"`. That means all files in this repository. @@ -24,6 +24,11 @@ or, for all nested folder `"src/**/*.h,src/**/*.c"` +### `excludes` +Sources to exclude from this action. It can be a single file, regex of a folder or multiple selectors separated by comma (`,`). + +Default: `""`. + ### `style` The style for `clang-format`. Possible value are: `LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit`. If your repository has a `.clang-format` file in the root directory then you can use `file` option here. diff --git a/entrypoint.sh b/entrypoint.sh index d037e4f..60e5a68 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,9 +44,11 @@ function find_cmd() { local -n cmd="$3" cmd+="find . -type f " - for exclude in $excludes; do - cmd+="! -wholename \"./$exclude\" " - done + if [ -n "$excludes" ]; then + for exclude in $excludes; do + cmd+="! -wholename \"./$exclude\" " + done + fi cmd+="\( " local is_first=1