Skip to content

Commit

Permalink
Merge pull request #72 from nayuta/support_reviewdog_parameter_changes
Browse files Browse the repository at this point in the history
Support reviewdog command line argument changes (--fail-level)
  • Loading branch information
shmokmt authored Jan 11, 2025
2 parents 990ec84 + 914851f commit c505a00
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,22 @@ See [reviewdog documentation for filter mode](https://github.com/reviewdog/revie

### `fail_on_error`

**Deprecated**. This option is no longer recommended for use and will be removed in future versions.

Optional. Exit code for reviewdog when errors are found [`true`, `false`].

The default is `false`.

See [reviewdog documentation for exit codes](https://github.com/reviewdog/reviewdog/tree/master#exit-codes) for details.

### `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.

The default is `none`.

See [reviewdog documentation for fail level](https://github.com/reviewdog/reviewdog/tree/master?tab=readme-ov-file#fail-level) for details.

### `flags`

Optional. Additional reviewdog flags. Useful for debugging errors, when it can be set to `-tee`.
Expand Down Expand Up @@ -139,6 +149,7 @@ jobs:
reporter: github-pr-review # Change reviewdog reporter
filter_mode: nofilter # Check all files, not just the diff
fail_on_error: true # Fail action if errors are found
fail_level: any # Fail action if any level of failures are found
flags: -tee # Add debug flag to reviewdog
trivy_flags: "" # Optional
```
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ inputs:
Default is added.
default: 'added'
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'
required: false
fail_on_error:
description: |
**Deprecated**. This option is no longer recommended for use and will be removed in future versions.
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
required: false
deprecationMessage: Deprecated, use `fail_level` instead.
flags:
description: 'Additional reviewdog flags'
default: ''
Expand Down Expand Up @@ -94,6 +101,7 @@ runs:
INPUT_TOOL_NAME: ${{ inputs.tool_name }}
INPUT_FILTER_MODE: ${{ inputs.filter_mode }}
INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
INPUT_FAIL_LEVEL: ${{ inputs.fail_level }}
INPUT_FLAGS: ${{ inputs.flags }}
INPUT_TRIVY_VERSION: ${{ inputs.trivy_version }}
INPUT_TRIVY_COMMAND: ${{ inputs.trivy_command }}
Expand Down
1 change: 1 addition & 0 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ echo '::group:: Running trivy with reviewdog 🐶 ...'
-reporter="${INPUT_REPORTER}" \
-level="${INPUT_LEVEL}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-fail-level="${INPUT_FAIL_LEVEL}" \
-filter-mode="${INPUT_FILTER_MODE}" \
${INPUT_FLAGS}

Expand Down

0 comments on commit c505a00

Please sign in to comment.