Static Checks #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Static Checks | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - "**/*.sh" | |
| - "**/*.bash" | |
| - "**/*.zsh" | |
| - ".github/workflows/*.yml" | |
| - ".github/workflows/*.yaml" | |
| - ".github/workflows/static-checks.yaml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "**/*.sh" | |
| - "**/*.bash" | |
| - "**/*.zsh" | |
| - ".github/workflows/*.yml" | |
| - ".github/workflows/*.yaml" | |
| - ".github/workflows/static-checks.yaml" | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| shell-static: | |
| name: Shell static checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install shellcheck, shfmt, and zsh | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y shellcheck shfmt zsh | |
| - name: Run shellcheck | |
| run: | | |
| mapfile -t shell_files < <(git ls-files '*.sh' '*.bash' | grep -v '^submodules/' || true) | |
| if [ "${#shell_files[@]}" -eq 0 ]; then | |
| echo "No sh/bash files found" | |
| exit 0 | |
| fi | |
| shellcheck "${shell_files[@]}" | |
| - name: Run shfmt diff check | |
| run: | | |
| mapfile -t shell_files < <(git ls-files '*.sh' '*.bash' | grep -v '^submodules/' || true) | |
| if [ "${#shell_files[@]}" -eq 0 ]; then | |
| echo "No sh/bash files found" | |
| exit 0 | |
| fi | |
| shfmt -d "${shell_files[@]}" | |
| - name: Run zsh syntax check | |
| run: | | |
| mapfile -t zsh_files < <(git ls-files '*.zsh' | grep -v '^submodules/' || true) | |
| if [ "${#zsh_files[@]}" -eq 0 ]; then | |
| echo "No zsh files found" | |
| exit 0 | |
| fi | |
| zsh -n "${zsh_files[@]}" | |
| actionlint: | |
| name: actionlint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Run actionlint | |
| uses: rhysd/actionlint@v1 |