GitHub action for ShellCheck.
on:
push:
branch:
- master
name: 'Trigger: Push action'
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
You can pass any supported ShellCheck option or flag with the SHELLCHECK_OPTS
env key in the job definition.
Some examples include:
- To disable specific checks (eg:
-e SC2059 -e SC2034 -e SC1090
) - To test against different shells (eg:
-s dash
or-s ksh
)
example:
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC2059 -e SC2034 -e SC1090
You can use the ignore
input to disable specific directories.
sample structure:
sample/directory/with/files/ignoreme/test.sh
sample/directory/with/files/ignoremetoo/test.sh
sample/directory/with/files/test.sh
example:
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore: ignoreme ignoremetoo
This will skip sample/directory/with/files/ignoreme/test.sh
and sample/directory/with/files/ignoremetoo/test.sh
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:
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
severity: error
If you run into SC1090/SC1091 errors you may need to tell shellcheck to check all files at once:
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
check_together: 'yes'
This can turn into a problem if you have enough script files to overwhelm the maximum argv length on your system.
If you have multiple directories with scripts, but only want to scan one of them, you can use the following configuration:
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: './scripts'
If you need to scan for unusual files, you can use the additional_files
key.
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
additional_files: 'run finish'
If you do not want to have the problem-matcher annotate files, you can disable it
by setting disable_matcher
to true
.
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
disable_matcher: true