This GitHub Action, named "Simple Shell Syntax Check", is designed to perform syntax checks on shell scripts. The action takes an optional input 'files'. If provided, it will check the syntax of these specific files. If not provided, locate all .sh files in the current folder.
| Input | required | Description |
|---|---|---|
| files | no | list of files to be checked |
| install_missing_shell | no | Find missing shells and install |
Outputs status of each file to the action summary
shbashdashfishkshzsh
The shell must exist on the runner to be able to test. If the shell doesn't exist, that test will fail.
You can install the shell before using this action
- name: Install fish
run: sudo apt-get install -y fishOr you can install all "missing" shells in a single command
- name: Install fish, ksh and zsh
run: sudo apt-get install -y fish ksh zsh- uses: actions/checkout@v4
- uses: Klintrup/simple-shell-syntax-check@v2- uses: actions/checkout@v4
- run: sudo apt-get install -y fish
- uses: Klintrup/simple-shell-syntax-check@v2- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
with:
files: |
**.sh
- uses: Klintrup/simple-shell-syntax-check@v2
if: steps.changed-files.outputs.any_changed == 'true'
with:
files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
install_missing_shell: true