name: Lint Bash Scripts on: push: paths: - '**/*.sh' pull_request: paths: - '**/*.sh' jobs: lint-bash: runs-on: docker container: image: node:16-bullseye steps: - name: Checkout Code uses: https://code.forgejo.org/actions/checkout@v4 with: fetch-depth: 0 - name: Install ShellCheck run: | apt-get update && apt-get install -y shellcheck - name: Run ShellCheck shell: bash run: | echo "Searching for shell scripts..." find . -name '*.sh' -print0 > shell-scripts.list echo "Running ShellCheck in each script's directory..." while IFS= read -r script; do echo "Checking $script" script_dir=$(dirname "$script") script_name=$(basename "$script") # Change to the script's directory and run ShellCheck (cd "$script_dir" && shellcheck -x "$script_name") done < shell-scripts.list