From 999f1fb33809b09cfaa17c82eadd2a5e6c65db60 Mon Sep 17 00:00:00 2001 From: Andrew Thrasher Date: Tue, 17 Sep 2024 11:13:16 -0400 Subject: [PATCH] chore: expose additional sprocket args --- action.yml | 10 ++++++++++ entrypoint.sh | 19 ++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 6618d58..21ff961 100644 --- a/action.yml +++ b/action.yml @@ -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" @@ -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 }} diff --git a/entrypoint.sh b/entrypoint.sh index bc66353..65fc0b9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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." @@ -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