diff --git a/.github/workflows/_shellcheck.yml b/.github/workflows/_shellcheck.yml index 3eea1cb..054a9df 100644 --- a/.github/workflows/_shellcheck.yml +++ b/.github/workflows/_shellcheck.yml @@ -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 @@ -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 \ No newline at end of file