From 87eb81cc511c2d8e95f2c062be40ba93d7d30710 Mon Sep 17 00:00:00 2001 From: Masaya Suzuki <15100604+massongit@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:35:43 +0900 Subject: [PATCH] Add fail_level and deduplicate fail_on_error (#76) --- README.md | 8 ++++++++ action.yml | 10 +++++++++- entrypoint.sh | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a3ad33..8ee315e 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,16 @@ Optional. The directory from which to look for and run detect-secrets. Default ' Optional. Reviewdog filter mode [added, diff_context, file, nofilter] It's the same as the `-filter-mode` flag of reviewdog. +### `fail_level` + +Optional. If set to `none`, always use exit code 0 for reviewdog. +Otherwise, exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to the given level. +Possible values: [`none`, `any`, `info`, `warning`, `error`] +Default is `none`. + ### `fail_on_error` +Deprecated, use `fail_level` instead. Whether reviewdog should fail when errors are found. [true,false] This is useful for failing CI builds in addition to adding comments when errors are found. It's the same as the `-fail-on-error` flag of reviewdog. diff --git a/action.yml b/action.yml index 120d5a3..0f5b416 100644 --- a/action.yml +++ b/action.yml @@ -13,8 +13,16 @@ inputs: filter_mode: description: Reviewdog filter mode [added, diff_context, file, nofilter] default: added + fail_level: + description: | + If set to `none`, always use exit code 0 for reviewdog. + Otherwise, exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to the given level. + Possible values: [none,any,info,warning,error] + Default is `none`. + default: 'none' fail_on_error: - description: Whether reviewdog should fail when errors are found. [true,false] - This is useful for failing CI builds. + description: Deprecated, use `fail_level` instead. Whether reviewdog should fail when errors are found. [true,false] - This is useful for failing CI builds. + deprecationMessage: Deprecated, use `fail_level` instead. default: "false" level: description: Report level for reviewdog [info,warning,error] diff --git a/entrypoint.sh b/entrypoint.sh index e0c8034..ba4b43f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,6 +28,7 @@ cat /tmp/.secrets.baseline | baseline2rdf ${SKIP_AUDITED_FLAG} ${VERBOSE_FLAG} \ -name="${INPUT_NAME:-detect-secrets}" \ -filter-mode="${INPUT_FILTER_MODE:-added}" \ -reporter="${INPUT_REPORTER:-github-pr-check}" \ + -fail-level="${INPUT_FAIL_LEVEL}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR}" \ -level="${INPUT_LEVEL}" \ ${INPUT_REVIEWDOG_FLAGS}