Skip to content

Commit

Permalink
chore: expose additional sprocket args
Browse files Browse the repository at this point in the history
  • Loading branch information
adthrasher committed Sep 17, 2024
1 parent ab4a956 commit 999f1fb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ inputs:
description: 'Comma separated list of patterns to exclude from Sprocket check.'
required: false
default: ''
deny-warnings:
description: 'Fail the check if there are any warnings.'
required: false
default: 'false'
deny-notes:
description: 'Fail the check if there are any notes.'
required: false
default: 'false'
outputs:
status:
description: "The status of the check"
Expand All @@ -19,4 +27,6 @@ runs:
entrypoint: "/app/entrypoint.sh"
args:
- ${{ inputs.lint == 'true' && '--lint' || '' }}
- ${{ inputs.deny-warnings == 'true' && '--deny-warnings' || '' }}
- ${{ inputs.deny-notes == 'true' && '--deny-notes' || '' }}
- ${{ inputs.exclude-paths }}
19 changes: 16 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
#!/bin/bash

lint=$1
exclusions=$2
lint=""
warnings=""
notes=""

while [ "$#" -gt 0 ]; do
arg=$1
case $1 in
-l|--lint) lint="--lint"; shift;;
-w|--deny-warnings) warnings="--deny-warnings"; shift;;
-n|--deny-notes) notes="--deny-notes"; shift;;
*) break;;
esac
done

exclusions=$1

if [ -n "$exclusions" ]; then
echo "Exclusions provided. Writing to .sprocket.yml."
Expand All @@ -26,7 +39,7 @@ do
fi
fi
echo " [***] $file [***]"
sprocket check $lint $file || EXITCODE=$(($? || EXITCODE))
sprocket check $lint $warnings $notes $file || EXITCODE=$(($? || EXITCODE))
done

echo "status=$EXITCODE" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 999f1fb

Please sign in to comment.