From 3cfb35d8053f2d09e4770c83803de496fd0a168d Mon Sep 17 00:00:00 2001 From: Angel1945uwu <97724347+Angel1945uwu@users.noreply.github.com> Date: Mon, 22 Dec 2025 17:45:02 +0100 Subject: [PATCH] ci: add bash -n syntax check for shell scripts CI job that runs bash -n on all *.sh files to catch shell syntax errors early. --- .github/workflows/shellcheck-bash-n.yml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/shellcheck-bash-n.yml diff --git a/.github/workflows/shellcheck-bash-n.yml b/.github/workflows/shellcheck-bash-n.yml new file mode 100644 index 00000000..0274b96e --- /dev/null +++ b/.github/workflows/shellcheck-bash-n.yml @@ -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