backup-automation/.forgejo/workflows/lint-bash.yml
ZoopaMario 859ef2e93f
All checks were successful
Check Commit Messages / check-commit-message (pull_request) Successful in 13s
Lint Bash Scripts / lint-bash (pull_request) Successful in 22s
Refactor code to make linter runs succeed
This commit refactors the codebase in order to make the shellcheck
workflow pass.
2024-12-29 15:51:16 +01:00

41 lines
1,011 B
YAML

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