1
0
Fork 0
mirror of https://github.com/ludeeus/action-shellcheck.git synced 2024-08-16 10:09:53 +02:00

Add severity input (#16)

Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
This commit is contained in:
Ilir Bekteshi 2020-06-26 08:05:34 +02:00 committed by GitHub
parent 06cf1c7f5d
commit 142c6d53df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 5 deletions

View file

@ -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
```

View file

@ -6,6 +6,10 @@ inputs:
description: 'Paths to ignore when running ShellCheck'
required: false
default: ''
severity:
description: 'Minimum severity of errors to consider. Options: [error, warning, info, style]'
required: false
default: ''
runs:
using: 'docker'
image: 'Dockerfile'

View file

@ -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"