From d394b4fb059353afe99a8266d9fa94184a547e87 Mon Sep 17 00:00:00 2001 From: Masaya Suzuki Date: Mon, 2 Dec 2024 21:52:32 +0900 Subject: [PATCH 1/2] Add fail_level and deduplicate fail_on_error --- README.md | 7 +++++++ action.yml | 9 +++++++++ script.sh | 3 +++ 3 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 5e1b0bd..014504a 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,15 @@ github-pr-review can use Markdown and add a link to rule page in reviewdog repor Optional. Filtering mode for the reviewdog command [added,diff_context,file,nofilter]. Default is `file`. +### `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. Optional. Exit code for reviewdog when errors are found [true,false] Default is `false`. diff --git a/action.yml b/action.yml index d979377..e861a13 100644 --- a/action.yml +++ b/action.yml @@ -23,10 +23,18 @@ inputs: Default is `file`. default: 'file' required: false + 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: | + Deprecated, use `fail_level` instead. Exit code for reviewdog when errors are found [true,false] Default is `false`. + deprecationMessage: Deprecated, use `fail_level` instead. default: 'false' required: false reviewdog_flags: @@ -71,6 +79,7 @@ runs: INPUT_LEVEL: ${{ inputs.level }} INPUT_REPORTER: ${{ inputs.reporter }} INPUT_FILTER_MODE: ${{ inputs.filter_mode }} + INPUT_FAIL_LEVEL: ${{ inputs.fail_level }} INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }} INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }} INPUT_PATH: ${{ inputs.path }} diff --git a/script.sh b/script.sh index 86432a9..93d1eca 100755 --- a/script.sh +++ b/script.sh @@ -75,6 +75,7 @@ if [ "${INPUT_REPORTER}" = 'github-pr-review' ]; then -name="shellcheck" \ -reporter=github-pr-review \ -filter-mode="${INPUT_FILTER_MODE}" \ + -fail-level="${INPUT_FAIL_LEVEL}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR}" \ -level="${INPUT_LEVEL}" \ ${INPUT_REVIEWDOG_FLAGS} @@ -88,6 +89,7 @@ else -name="shellcheck" \ -reporter="${INPUT_REPORTER:-github-pr-check}" \ -filter-mode="${INPUT_FILTER_MODE}" \ + -fail-level="${INPUT_FAIL_LEVEL}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR}" \ -level="${INPUT_LEVEL}" \ ${INPUT_REVIEWDOG_FLAGS} @@ -105,6 +107,7 @@ shellcheck -f diff ${FILES} \ -f.diff.strip=1 \ -reporter="github-pr-review" \ -filter-mode="${INPUT_FILTER_MODE}" \ + -fail-level="${INPUT_FAIL_LEVEL}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR}" \ ${INPUT_REVIEWDOG_FLAGS} EXIT_CODE_SUGGESTION=$? From e48fb596942ddbe25787dce8eb7a849e4a9a996f Mon Sep 17 00:00:00 2001 From: Masaya Suzuki Date: Tue, 3 Dec 2024 08:45:38 +0900 Subject: [PATCH 2/2] Add line break --- README.md | 3 ++- action.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 014504a..b688854 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ Default is `file`. ### `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. +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`. diff --git a/action.yml b/action.yml index e861a13..29542af 100644 --- a/action.yml +++ b/action.yml @@ -25,7 +25,8 @@ inputs: required: false 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. + 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'