Skip to content

Commit

Permalink
Merge pull request #59 from reviewdog/add_fail_level
Browse files Browse the repository at this point in the history
Add fail_level and deduplicate fail_on_error
  • Loading branch information
massongit authored Dec 3, 2024
2 parents 3459629 + 0f5148b commit 1371ffd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,16 @@ Please note that some command-line arguments can be defined with other fields in

**Optional**. Filtering mode for the reviewdog command `[added, diff_context, file, nofilter]`. Defaults to `added`.

### `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]`. Defaults to `false`.

#### `reviewdog_flags`
Expand Down
11 changes: 10 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ inputs:
description: "Filtering mode for the reviewdog command [added, diff_context, file, nofilter]."
required: false
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: "Exit code for reviewdog when errors are found [true, false]."
description: "Deprecated, use `fail_level` instead. Exit code for reviewdog when errors are found [true, false]."
deprecationMessage: Deprecated, use `fail_level` instead.
required: false
default: "false"
reviewdog_flags:
Expand All @@ -57,6 +65,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 }}

Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ flake8 --version

echo "[action-flake8] Checking python code with the flake8 linter and reviewdog..."
exit_val="0"
# shellcheck disable=SC2086
flake8 . ${INPUT_FLAKE8_ARGS} 2>&1 | # Removes ansi codes see https://github.com/reviewdog/errorformat/issues/51
/tmp/reviewdog -f="${INPUT_ERROR_FORMAT}" \
-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} || exit_val="$?"
Expand Down

0 comments on commit 1371ffd

Please sign in to comment.