From ef7ea4380fa10c72a1671f16f4fa37927c75f42c Mon Sep 17 00:00:00 2001 From: Bilka Date: Mon, 2 Dec 2024 12:29:46 +0100 Subject: [PATCH] Added input for fail-level reviewdog flag to later replace deprecated fail-on-error reviewdog flag (#124) * Replace deprecated fail-on-error flag with fail-level * Restore fail-on-error flag * Update doc with suggestions --- README.md | 7 +++++++ action.yml | 9 +++++++++ script.sh | 1 + 3 files changed, 17 insertions(+) diff --git a/README.md b/README.md index 7fc2719..e45c49e 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,15 @@ With `reporter: github-pr-review` a comment is added to the Pull Request Convers +### `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 b7f08da..b36a557 100644 --- a/action.yml +++ b/action.yml @@ -3,11 +3,19 @@ description: '🐶 Run rubocop with reviewdog on pull requests to improve code r author: 'mgrachev (reviewdog)' inputs: # Please maintain inputs in alphabetical order + 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`. default: 'false' + deprecationMessage: Deprecated, use `fail_level` instead. filter_mode: description: | Filtering mode for the reviewdog command [added,diff_context,file,nofilter]. @@ -63,6 +71,7 @@ runs: # INPUT_ is not available in Composite run steps # https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611 # Please maintain inputs in alphabetical order + INPUT_FAIL_LEVEL: ${{ inputs.fail_level }} INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }} INPUT_FILTER_MODE: ${{ inputs.filter_mode }} INPUT_GITHUB_TOKEN: ${{ inputs.github_token }} diff --git a/script.sh b/script.sh index 9693ca0..2a69a4c 100755 --- a/script.sh +++ b/script.sh @@ -132,6 +132,7 @@ ${BUNDLE_EXEC}rubocop \ -name="${INPUT_TOOL_NAME}" \ -reporter="${INPUT_REPORTER}" \ -filter-mode="${INPUT_FILTER_MODE}" \ + -fail-level="${INPUT_FAIL_LEVEL}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR}" \ -level="${INPUT_LEVEL}" \ ${INPUT_REVIEWDOG_FLAGS}