Action for checking scripts with Shellcheck.
Create file .github/workflows/shellcheck.yml
.
Add next code to it:
name: CI
on:
push:
branches: [master, develop]
pull_request:
branches: [master]
jobs:
Shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Check scripts with Shellcheck
uses: essentialkaos/shellcheck-action@v1
with:
files: src/script1.sh src/script2.sh
severity: error
format: gcc
shell: dash
You can disable specific checks through environment variables:
- name: Check scripts with Shellcheck
uses: essentialkaos/shellcheck-action@v1
env:
SHELLCHECK_OPTS: -e SC1117 -e SC2034 -e SC2154
with:
files: src/script1.sh src/script2.sh
Option | Description | Value |
---|---|---|
files |
List of scripts for checking | Paths |
version |
Version of Shellcheck | Version in semver notation |
severity |
Minimum severity of errors to consider | Severity |
format |
The output format for the results | checkstyle diff gcc json json1 quiet tty |
shell |
Script dialect | sh bash dash ksh |