Skip to content

CI — Shell

Runs ShellCheck → actionlint → Bats → Docker for shell script projects. Each stage is independently toggleable.

Usage

yaml
jobs:
  ci:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/ci-shell.yml@main
    with:
      run-shellcheck: true
      run-actionlint: true
      run-bats: true
      run-link-check: true
      link-check-paths: 'docs/**/*.md'
      run-docker: false

Inputs

InputTypeDefaultDescription
run-shellcheckbooleantrueRun ShellCheck on all .sh files
shellcheck-severitystringwarningMinimum severity: error | warning | info | style
shellcheck-exclude-pathsstring*/test_helper/*Glob passed to find -not -path to exclude from analysis
run-actionlintbooleantrueRun actionlint on GitHub Actions workflow files
actionlint-pathsstring.github/workflows/Space-separated paths to validate
actionlint-flagsstring''Extra flags passed to actionlint
run-batsbooleantrueRun Bats unit tests
bats-tests-dirstringtests/Directory (or file) containing .bats test files
bats-submodulesbooleantrueCheckout git submodules required by Bats helpers
run-dockerbooleanfalseRun Docker integration tests
docker-filestringtests/docker/Dockerfile.testPath to the test Dockerfile
docker-targetsstring'[]'JSON array of --target names to build (e.g. '["test-bats","test-init"]')
run-link-checkbooleanfalseCheck markdown files for broken relative links (offline, no HTTP requests)
link-check-pathsstringdocs/**/*.mdSpace-separated glob patterns of markdown files to check
run-docs-link-checkbooleanfalseCheck that no relative links in docs/ escape the docs/ directory
run-vitepress-checkbooleanfalseCheck docs/ markdown for unescaped Vue interpolations that break the VitePress SSR build
docs-directorystringdocsPath to the docs folder checked by docs-link-check and vitepress-check
runnerstring'"ubuntu-latest"'Runner labels as JSON — e.g. '"ubuntu-latest"' or '["self-hosted","linux","k3s","kaniko"]'

Secrets

SecretRequiredDescription
tokennoGitHub token or PAT used to checkout private submodules. Falls back to the default GITHUB_TOKEN.

Jobs

JobCondition
shellcheckrun-shellcheck: true
validate-yamlrun-actionlint: true
batsrun-bats: true
docker-testrun-docker: true (matrix over docker-targets)
link-checkrun-link-check: true
docs-link-checkrun-docs-link-check: true
vitepress-checkrun-vitepress-check: true

Notes

  • Docker targets run in parallel via a matrix strategy with fail-fast: false.
  • The bats-submodules flag applies to both the bats and docker-test jobs.
  • ShellCheck and actionlint use their own composite actions: shellcheck, actionlint. actionlint covers YAML syntax, expression type checking, and action input validation — no separate yamllint needed.
  • link-check runs lychee in offline mode — no external HTTP requests are made.
  • vitepress-check uses the check-vitepress-md action — guards against {{ }} interpolations that crash the VitePress SSR build (see cd-docs).