Check the repository's shell scripts for problems:
- Static analysis using ShellCheck.
- Formatting using shfmt.
- Forgotten executable script file permissions.
This is the version of the workflow for projects using the Task task runner tool.
Install the check-shell-task.yml
GitHub Actions workflow to .github/workflows/
.editorconfig
-shfmt
will use this configuration file.- Install to: repository root
Taskfile.yml
- Tasks for checking shell scripts.- Install to: repository root (or merge into the existing
Taskfile.yml
).
- Install to: repository root (or merge into the existing
The formatting style defined in .editorconfig
is the official standardized style to be used in all Arduino tooling projects and should not be modified.
Configure the paths of the shell scripts to be checked as elements in the job matrices of check-shell-task.yml
at:
jobs.lint.strategy.matrix.script[]
jobs.formatting.strategy.matrix.script[]
jobs.executable.strategy.matrix.script[]
matrix:
script:
- path/to/some-script.sh
- path/to/another-script.sh
The workflow is configured to be triggered on changes to any files in the repository that have a .sh
or .bash
file extension. If the project contains shell scripts without a file extension, the path to those scripts must be added to the following keys in check-shell-task.yml
:
on.push.paths[]
on.pull_request.paths[]
Markdown badge:
[](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/check-shell-task.yml)
Replace the TODO_REPO_OWNER
and TODO_REPO_NAME
placeholders in the URLs with the final repository owner and name (example).
Asciidoc badge:
image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-shell-task.yml/badge.svg["Check Shell Scripts status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-shell-task.yml"]
Define the {repository-owner}
and {repository-name}
attributes and use them throughout the readme (example).
Add CI workflow to check for problems with shell scripts
On every push or pull request that modifies one of the shell scripts in the repository, and periodically, the workflow:
- Runs ShellCheck to detect common problems.
- Runs shfmt to check formatting.
- Checks for forgotten executable script file permissions.
On every push or pull request that modifies one of the shell scripts in the repository, and periodically, the workflow:
- Runs [ShellCheck](https://github.com/koalaman/shellcheck) to detect common problems.
- Runs [`shfmt`](https://github.com/mvdan/sh) to check formatting.
- Checks for forgotten executable script file permissions.
In addition to the automated checks provided by the GitHub Actions workflow, the tasks can be ran locally.
The following development tools must be available in your local environment:
- ShellCheck - shell script static analysis tool.
- shfmt - shell script formatting tool.
- Task task runner tool.
task shell:check SCRIPT_PATH="<script path>"
(where <script path>
is the path to the script file)
task shell:check-mode SCRIPT_PATH="<script path>"
(where <script path>
is the path to the script file)
task shell:format SCRIPT_PATH="<script path>"
(where <script path>
is the path to the script file)