diff --git a/README.md b/README.md index cc5e239..9b2f43f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ _GitHub action for ShellCheck._ ## Example ```yaml -on: +on: push: branch: - master @@ -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 +``` diff --git a/action.yaml b/action.yaml index 5009b95..f131351 100644 --- a/action.yaml +++ b/action.yaml @@ -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' \ No newline at end of file + icon: 'terminal' + color: 'gray-dark' diff --git a/runaction.sh b/runaction.sh index 2035c01..d10ee42 100755 --- a/runaction.sh +++ b/runaction.sh @@ -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"