Skip to content

Commit

Permalink
Add severity input (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: Joakim Sørensen <[email protected]>
  • Loading branch information
ibiqlik and ludeeus authored Jun 26, 2020
1 parent 06cf1c7 commit 142c6d5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _GitHub action for ShellCheck._
## Example

```yaml
on:
on:
push:
branch:
- master
Expand Down Expand Up @@ -57,3 +57,17 @@ example:
```

This will skip `sample/directory/with/files/toignore/test.sh`

## Minimum severity of errors to consider (error, warning, info, style)

You can use the `severity` input to not fail until specified severity is met, for example fail only if there are errors in scripts but ignore styling, info and warnings.

example:

```yaml
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
severity: error
```
10 changes: 7 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ inputs:
description: 'Paths to ignore when running ShellCheck'
required: false
default: ''
runs:
severity:
description: 'Minimum severity of errors to consider. Options: [error, warning, info, style]'
required: false
default: ''
runs:
using: 'docker'
image: 'Dockerfile'
branding:
icon: 'terminal'
color: 'gray-dark'
icon: 'terminal'
color: 'gray-dark'
4 changes: 3 additions & 1 deletion runaction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ then
echo >&2 "::warning:: programs in PATH should not have a filename suffix"
fi

[[ -n "${INPUT_SEVERITY}" ]] && options+=(-S "${INPUT_SEVERITY}")

for file in "${filepaths[@]}"; do
echo "::debug:: Checking $file"
shellcheck "$file" || statuscode=$?
shellcheck "${options[@]}" "$file" || statuscode=$?
done

exit "$statuscode"

0 comments on commit 142c6d5

Please sign in to comment.