Skip to content

Commit

Permalink
Merge pull request #754 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 745cf59 + db279af commit dd3fda9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,16 @@ It's same as `-reporter` flag of reviewdog.
Optional. Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is 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`]
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 @@ -28,10 +28,19 @@ inputs:
Default is added.
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: |
Deprecated, use `fail_level` instead.
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
deprecationMessage: Deprecated, use `fail_level` instead.
required: false
default: "false"
reviewdog_flags:
Expand Down
2 changes: 2 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ async function run(): Promise<void> {
const level = core.getInput("level") || "error";
const reporter = core.getInput("reporter") || "github-pr-check";
const filterMode = core.getInput("filter_mode") || "added";
const failLevel = core.getInput("fail_level") || "none";
const failOnError = core.getInput("fail_on_error") || "false";
const reviewdogFlags = core.getInput("reviewdog_flags");
const workdir = core.getInput("workdir") || ".";
Expand Down Expand Up @@ -85,6 +86,7 @@ async function run(): Promise<void> {
`-name=${toolName}`,
`-reporter=${reporter}`,
`-filter-mode=${filterMode}`,
`-fail-level=${failLevel}`,
`-fail-on-error=${failOnError}`,
`-level=${level}`,
...flags.parse(reviewdogFlags),
Expand Down

0 comments on commit dd3fda9

Please sign in to comment.