Skip to content

Commit

Permalink
Add fail_level and deduplicate fail_on_error
Browse files Browse the repository at this point in the history
  • Loading branch information
massongit committed Dec 2, 2024
1 parent ccaafec commit d394b4f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -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=$?
Expand Down

0 comments on commit d394b4f

Please sign in to comment.