Skip to content
Merged
Show file tree
Hide file tree
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
24 changes: 22 additions & 2 deletions .github/workflows/beautysh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/excluded.pattern.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Dummy file to test exclusion in beautysh workflow
1 change: 1 addition & 0 deletions tests/workflows/excluded.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Dummy file to test exclusion in beautysh workflow