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:
parent
06cf1c7f5d
commit
142c6d53df
3 changed files with 25 additions and 5 deletions
14
README.md
14
README.md
|
@ -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
|
||||
```
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue