diff --git a/.github/workflows/beautysh.yml b/.github/workflows/beautysh.yml index 2474191..efe65ad 100644 --- a/.github/workflows/beautysh.yml +++ b/.github/workflows/beautysh.yml @@ -12,6 +12,11 @@ on: type: string required: false default: --force-function-style paronly + exclude: + description: Comma-separated list of file paths or glob patterns to exclude + type: string + required: false + default: jobs: beautysh: name: Run beautysh @@ -43,9 +48,24 @@ jobs: grep -rlZx --exclude="*.phar" '#!/usr/bin/env bash' ${{ inputs.dir }} >> ~/beautysh.temp # Deduplicate list sort -z ~/beautysh.temp | uniq -z > ~/beautysh.files + + # Remove excluded files + > ~/beautysh.filtered + IFS=, read -r -a patterns <<< "${{ inputs.exclude }}" + while IFS= read -r -d '' file; do + skip= + for pattern in "${patterns[@]}"; do + if [[ "${file}" == ${pattern} ]]; then + skip=1 + break + fi + done + [[ -z "${skip}" ]] && printf '%s\0' "${file}" >> ~/beautysh.filtered + done < ~/beautysh.files + # List files (for debug) echo "Files found:" - cat ~/beautysh.files | tr '\0' '\n' + cat ~/beautysh.filtered | tr '\0' '\n' - name: Check code-style - run: xargs -0 beautysh --check ${{ inputs.params }} < ~/beautysh.files + run: xargs -0 beautysh --check ${{ inputs.params }} < ~/beautysh.filtered diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f170023..08e8439 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,6 +20,7 @@ jobs: with: dir: tests/workflows params: --force-function-style fnpar --indent-size 2 --variable-style braces + exclude: tests/workflows/excluded.sh,*pattern.sh test-mkdocs: name: Test workflow (mkdocs) diff --git a/README.md b/README.md index e3a2b98..2e7e05c 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,11 @@ params: type: string required: false default: --force-function-style paronly +exclude: + description: Comma-separated list of file paths or glob patterns to exclude + type: string + required: false + default: ``` **Example** @@ -46,6 +51,7 @@ jobs: with: dir: bin/ params: --force-function-style fnpar --indent-size 2 + exclude: bin/excluded.sh,*pattern.sh ``` ### github-release.yml diff --git a/tests/workflows/excluded.pattern.sh b/tests/workflows/excluded.pattern.sh new file mode 100644 index 0000000..4f0d85f --- /dev/null +++ b/tests/workflows/excluded.pattern.sh @@ -0,0 +1 @@ +# Dummy file to test exclusion in beautysh workflow diff --git a/tests/workflows/excluded.sh b/tests/workflows/excluded.sh new file mode 100644 index 0000000..4f0d85f --- /dev/null +++ b/tests/workflows/excluded.sh @@ -0,0 +1 @@ +# Dummy file to test exclusion in beautysh workflow