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
16
README.md
16
README.md
|
@ -5,7 +5,7 @@ _GitHub action for ShellCheck._
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
||||||
|
@ -57,3 +57,17 @@ example:
|
||||||
```
|
```
|
||||||
|
|
||||||
This will skip `sample/directory/with/files/toignore/test.sh`
|
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
action.yaml
10
action.yaml
|
@ -6,9 +6,13 @@ inputs:
|
||||||
description: 'Paths to ignore when running ShellCheck'
|
description: 'Paths to ignore when running ShellCheck'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
runs:
|
severity:
|
||||||
|
description: 'Minimum severity of errors to consider. Options: [error, warning, info, style]'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
branding:
|
branding:
|
||||||
icon: 'terminal'
|
icon: 'terminal'
|
||||||
color: 'gray-dark'
|
color: 'gray-dark'
|
||||||
|
|
|
@ -66,9 +66,11 @@ then
|
||||||
echo >&2 "::warning:: programs in PATH should not have a filename suffix"
|
echo >&2 "::warning:: programs in PATH should not have a filename suffix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[[ -n "${INPUT_SEVERITY}" ]] && options+=(-S "${INPUT_SEVERITY}")
|
||||||
|
|
||||||
for file in "${filepaths[@]}"; do
|
for file in "${filepaths[@]}"; do
|
||||||
echo "::debug:: Checking $file"
|
echo "::debug:: Checking $file"
|
||||||
shellcheck "$file" || statuscode=$?
|
shellcheck "${options[@]}" "$file" || statuscode=$?
|
||||||
done
|
done
|
||||||
|
|
||||||
exit "$statuscode"
|
exit "$statuscode"
|
||||||
|
|
Loading…
Reference in a new issue