This GitHub action is used to perform the linting of shell scripts for best practices.
name: GitHub Workflow
on:
push:
branches:
- main
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: anantacloud-oss/shellcheck-action@mainAdditionally you can pass supported ShellCheck option or flags with the SHELLCHECK_OPTS env key in the job definition.
For Example:
- To disable specific checks:
-e SC2059 -e SC2034
example:
...
- name: Run ShellCheck
uses: anantacloud-oss/shellcheck-action@main
with:
SHELLCHECK_OPTS: -e SC2059 -e SC2034You can use the ignore_paths and ignore_names input to disable specific directories and files.
For Example:
...
- name: Run ShellCheck
uses: anantacloud-oss/shellcheck-action@main
with:
ignore_paths: ignore_xxxxx
ignore_names: ignore_xxxxx.shYou can use the severity input to define the severity. Default value is 'error'.
example:
...
- name: Run ShellCheck
uses: anantacloud-oss/shellcheck-action@main
with:
severity: errorIf you have multiple directories with scripts, but only want to scan one of them, you can use the following configuration:
...
- name: Run ShellCheck
uses: anantacloud-oss/shellcheck-action@main
with:
scandir: './scripts'Shellcheck can print output in these formats: checkstyle, diff, gcc, json, json1, quiet, tty. Dfault is checkstyle.
ttyhas multi-line log messages, but all annotations are reported as errorsgcchas single-line log messages, so it's easier to parse with a problem matcher (including correct severity annotation)
...
- name: Run ShellCheck
uses: anantacloud-oss/shellcheck-action@main
with:
format: jsonIf running the latest stable version of Shellcheck is not to your liking, you can specify a concrete version of Shellcheck to be used.
...
- name: Run ShellCheck
uses: anantacloud-oss/shellcheck-action@main
with:
version: v0.7.0We would love you to contribute to @anantacloud-oss/shellcheck-action, pull requests are welcome! Please see the CONTRIBUTING.md for more information.
The scripts and documentation in this project are released under the MIT License