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
33 changes: 18 additions & 15 deletions .github/workflows/_shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: shellcheck
on:
workflow_call: {}
workflow_call:
inputs:
exclude:
description: "Path pattern to exclude (e.g., './operator/*')"
required: false
type: string
default: ""

permissions:
contents: read
Expand All @@ -10,21 +16,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for shell scripts
id: check

- name: Install shellcheck
run: sudo apt-get update && sudo apt-get install -y shellcheck

- name: Run shellcheck
run: |
if compgen -G "**/*.sh" > /dev/null; then
echo "found=true" >> $GITHUB_OUTPUT
else
echo "found=false" >> $GITHUB_OUTPUT
EXCLUDE_PATH="${{ inputs.exclude }}"
if [ -z "$EXCLUDE_PATH" ]; then
EXCLUDE_PATH="./.git/*" # Dummy path
fi

- name: Install and run shellcheck
if: steps.check.outputs.found == 'true'
run: |
sudo apt-get update && sudo apt-get install -y shellcheck
shellcheck **/*.sh
echo "Running shellcheck (excluding: $EXCLUDE_PATH)..."


- name: No scripts found
if: steps.check.outputs.found == 'false'
run: echo "No shell scripts found, skipping."
find . -type f -name "*.sh" -not -path "$EXCLUDE_PATH" -exec shellcheck {} + || true