Action — shellcheck
Runs ShellCheck on all .sh files in the repository, and on the extensionless scripts extra-paths names.
Usage
yaml
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: KevinDeBenedetti/github-workflows/.github/actions/shellcheck@v0.57.0 # x-release-please-version
with:
severity: warningInputs
| Input | Type | Default | Description |
|---|---|---|---|
severity | string | warning | Minimum severity level: error | warning | info | style |
exclude-paths | string | */test_helper/* | One glob passed to find -not -path to exclude from analysis |
extra-paths | string | '' | Space-separated globs (find -path, from the repository root) checked whatever their name |
default-shell | string | bash | Dialect for scripts with neither a supported shebang nor a # shellcheck shell= directive |
Notes
- Finds all
*.shfiles recursively under the current directory (excludingexclude-paths, and never descending into.git,node_modulesor.venv). - Each script is checked as the shell its shebang (or
# shellcheck shell=directive) declares, so#!/bin/shscripts get POSIX checks; only undeclared scripts, and scripts whose shebang names a shell ShellCheck does not support (zsh,fish…), fall back todefault-shell. - A file only
extra-pathsmatches (scripts/*/*for commands without an extension) is checked when its shebang or a# shellcheck shell=directive declares a supported shell. The others, a Python tool or a README among the scripts, are skipped and listed in a notice instead of failing the step.exclude-pathsapplies to them too. - Reports issues in GCC format for clean integration with GitHub annotations.
- An unknown
severityordefault-shellfails the step. The rules are at the top ofshellcheck.sh, next toaction.yml. - Installs a pinned ShellCheck release (x86_64 or aarch64) with
install-tool, which needspython3on the runner.