diff --git a/.github/workflows/lint-and-docs.yaml b/.github/workflows/lint-and-docs.yaml index ebffbfe..706ffa4 100644 --- a/.github/workflows/lint-and-docs.yaml +++ b/.github/workflows/lint-and-docs.yaml @@ -34,10 +34,32 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + # Runs the runner image's shellcheck on tracked shell scripts and on + # executables with no extension whose first line names a shell. - name: ShellCheck - uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0 - with: - scandir: '.' + run: | + if ! command -v shellcheck >/dev/null; then + echo "::error::This runner has no shellcheck. GitHub's Ubuntu images carry it; on another runner, install it first." + exit 1 + fi + shellcheck --version + files=() + while IFS= read -r -d '' f; do + [[ -f $f && ! -L $f ]] || continue + case ${f##*/} in + *.sh | *.bash | *.ksh | *.shlib) files+=("$f") ;; + *.*) ;; + *) + if [[ -x $f ]] && head -n1 "$f" | grep -Eq '^#! */[^ ]*/(env *)?[abk]*sh'; then + files+=("$f") + fi + ;; + esac + done < <(git ls-files -z) + if ((${#files[@]})); then + printf 'Checking %s\n' "${files[@]}" + shellcheck --format=gcc "${files[@]}" + fi lint-workflows: name: Lint GitHub Actions workflows diff --git a/CHANGELOG.md b/CHANGELOG.md index ece9691..ed69de8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The `v0.0.0` tag is a baseline, not a release: it marks where versioning starts ## [Unreleased] +### Fixed + +- **The shell lint runs the runner image's shellcheck instead of downloading one.** + ## [0.2.4] - 2026-11-30 ### Fixed