From b53abf0dc25b25620928875d60c8d0956edb4d64 Mon Sep 17 00:00:00 2001 From: Masaya Suzuki Date: Tue, 3 Dec 2024 07:39:19 +0900 Subject: [PATCH 1/2] Add fail_level and deduplicate fail_on_error --- README.md | 7 +++++++ action.yml | 10 +++++++++- script.sh | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 05cb1d2..6e16a1d 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,15 @@ code review experience. ## Inputs +### `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 29806de..015293f 100644 --- a/action.yml +++ b/action.yml @@ -9,8 +9,15 @@ inputs: level: description: 'Report level for reviewdog [info,warning,error]' default: 'error' + 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' filter_mode: description: 'Reviewdog filter mode [added, diff_context, file, nofilter]' @@ -46,6 +53,7 @@ runs: REVIEWDOG_VERSION: v0.20.2 INPUT_GITHUB_TOKEN: ${{ inputs.github_token }} INPUT_LEVEL: ${{ inputs.level }} + INPUT_FAIL_LEVEL: ${{ inputs.fail_level }} INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }} INPUT_FILTER_MODE: ${{ inputs.filter_mode }} INPUT_NAME: ${{ inputs.name }} diff --git a/script.sh b/script.sh index fa33b45..0d9628e 100755 --- a/script.sh +++ b/script.sh @@ -25,6 +25,7 @@ __run_reviewdog() { -reporter="${INPUT_REPORTER}" \ -level="${INPUT_LEVEL}" \ -filter-mode="${INPUT_FILTER_MODE}" \ + -fail-level="${INPUT_FAIL_LEVEL}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR}" } From d5e4c56cf1d67c91abf21ed0186e349e43961fe1 Mon Sep 17 00:00:00 2001 From: Masaya Suzuki Date: Tue, 3 Dec 2024 10:02:56 +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 6e16a1d..fcb70e0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ code review experience. ### `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 015293f..6225479 100644 --- a/action.yml +++ b/action.yml @@ -11,7 +11,8 @@ inputs: default: 'error' 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'