From 83ba654d26eb3f7ce3c0edcc3edbf79d1296da1d Mon Sep 17 00:00:00 2001 From: Andrew Thrasher Date: Wed, 23 Oct 2024 13:31:18 -0400 Subject: [PATCH] feat: expose --except option (#4) * feat: expose --except option --- Dockerfile | 2 +- README.md | 2 ++ action.yml | 4 ++++ entrypoint.sh | 18 +++++++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd9ce1d..10f7da6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.81 +FROM rust:1.82 WORKDIR /app COPY . . diff --git a/README.md b/README.md index 9d09aee..dcca51a 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ This action uses [Sprocket](https://github.com/stjude-rust-labs/sprocket) to val **Optional** If specified, Sprocket `check` will fail if any `warnings` are produced. ### `deny-notes` **Optional** If specified, Sprocket `check` will fail if any `notes` are produced. +### `except` +**Optional** If specified and `lint`==`true`, then the listed rules will be excepted from all `sprocket lint` checks. Multiple rules can be specified as a comma-separated list, e.g. `CallInputSpacing,CommandSectionMixedIndentation`. Valid options can be found at: https://docs.rs/wdl/latest/wdl/lint/index.html#lint-rules. ## Example usage diff --git a/action.yml b/action.yml index 2498f28..279b205 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,10 @@ inputs: description: 'Fail the check if there are any notes.' required: false default: 'false' + except: + description: 'Comma separated list of rules to exclude from Sprocket check.' + required: false + default: '' outputs: status: description: "The status of the check" diff --git a/entrypoint.sh b/entrypoint.sh index 7cf3ff4..aa186a2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,24 @@ #!/bin/bash +echo "===configuration===" +echo "lint: $INPUT_LINT" +echo "exceptions: $INPUT_EXCEPT" +echo "warnings: $INPUT_WARNINGS" +echo "notes: $INPUT_NOTES" +echo "patterns: $INPUT_PATTERNS" + lint="" +exceptions="" if [ $INPUT_LINT = "true" ]; then lint="--lint" + if [ -n "$INPUT_EXCEPT" ]; then + echo "Excepted rule(s) provided." + for exception in $(echo $INPUT_EXCEPT | sed 's/,/ /') + do + exceptions="$exceptions --except $exception" + done + fi fi warnings="" @@ -43,7 +58,8 @@ do fi fi echo " [***] $file [***]" - sprocket check $lint $warnings $notes $file || EXITCODE=$(($? || EXITCODE)) + echo "sprocket check $lint $warnings $notes $exceptions $file" + sprocket check $lint $warnings $notes $exceptions $file || EXITCODE=$(($? || EXITCODE)) done echo "status=$EXITCODE" >> $GITHUB_OUTPUT