Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/shellcheck-bash-n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Shell script syntax check

on:
pull_request:
paths:
- "**/*.sh"
push:
branches:
- main
paths:
- "**/*.sh"

jobs:
bash_syntax:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Find shell scripts and run bash -n
run: |
set -euo pipefail
scripts="$(find . -type f -name '*.sh' -print0 | tr '\0' '\n')"
if [ -z "$scripts" ]; then
echo "No shell scripts found, nothing to check."
exit 0
fi
echo "$scripts" | while read -r file; do
echo "Checking $file"
bash -n "$file"
done