Skip to content

Commit

Permalink
feat: adding exclude: list, to exclude a list of folders
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperFola committed Sep 22, 2024
1 parent 19cb0a7 commit d62a366
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ jobs:
- uses: ArkScript-lang/action-format@master
with:
folder: example/
excluded: example/excluded/
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ inputs:
folder:
description: 'Folder with .ark files to check'
required: true
exclude:
description: 'Folders to exclude, comma separated'
```

- folder: path to ArkScript files ; will be scanned recursively for `*.ark` files
- **folder**: path to ArkScript files ; will be scanned recursively for `*.ark` files
- **exclude**: list of path to exclude, eg `foo,bar,egg/test`

13 changes: 12 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ inputs:
folder:
description: 'Folder with .ark files to check'
required: true
exclude:
description: 'Folders to exclude, comma separated'

runs:
using: 'composite'
Expand All @@ -22,12 +24,21 @@ runs:
- name: Check
shell: bash
run: |
exclusions=
if [ -z "${{ inputs.exclude }}" ]; then
IFS=',' read -ra EXC <<< "${{ inputs.exclude }}"
for i in "${EXC[@]}"; do
# process "$i"
exclusions="$exclusions -not -path $i"
done
fi
failures=0
while read -rd $'\0' file; do
if ! ./arkscript --format "$file" --check; then
echo "❌ $(basename $file) is not formatted correctly"
failures=$((failures+1))
fi
done < <(find "${{ inputs.folder }}" -type f -name "*.ark" -print0)
done < <(find "${{ inputs.folder }}" $exclusions -type f -name "*.ark" -print0)
echo $failures
[ $failures -gt 0 ] && exit 1 || exit 0
4 changes: 4 additions & 0 deletions example/excluded/test.ark
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(let a
5)
# this should fail

0 comments on commit d62a366

Please sign in to comment.