Skip to content

Commit

Permalink
Merge pull request #9 from kadler/master
Browse files Browse the repository at this point in the history
Only add excludes to find command if it's defined
  • Loading branch information
RafikFarhad authored Nov 12, 2023
2 parents 7cbc1d8 + 6a2185a commit 212967e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.

Expand Down
8 changes: 5 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 212967e

Please sign in to comment.