Skip to content

Commit

Permalink
Merge pull request #67 from mongolyy/add-fail-level-support
Browse files Browse the repository at this point in the history
Add `-fail-level` support and deprecate `-fail-on-error`
  • Loading branch information
massongit authored Jan 12, 2025
2 parents db4abb1 + c17dcbb commit a3026c6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"
- run: go install mvdan.cc/sh/v3/cmd/shfmt@latest

- run: shfmt -i 2 -ci -w .
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,17 @@ inputs:
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is diff_context. GitHub suggestions only support added and diff_context.
default: 'diff_context'
fail_level:
description: |
Exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to given level [none,any,info,warning,error].
If set to `none`, always exit with 0.
Default is `none`.
default: 'none'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
deprecationMessage: Deprecated, use `fail_level` instead.
default: 'false'
reviewdog_flags:
description: 'Additional reviewdog flags'
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ inputs:
Default is diff_context. GitHub suggestions only support added and diff_context.
default: "diff_context"
required: false
fail_level:
description: |
Exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to given level [any,info,warning,error].
If set to `none`, always exit with 0.
Default is `none`.
default: "none"
required: false
fail_on_error:
description: |
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 @@ -61,6 +69,7 @@ runs:
INPUT_TOOL_NAME: ${{ inputs.tool_name }}
INPUT_LEVEL: ${{ inputs.level }}
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_CLEANUP: ${{ inputs.cleanup }}
Expand Down
1 change: 1 addition & 0 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ reviewdog \
-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}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} <"${TMPFILE}" # INPUT_REVIEWDOG_FLAGS is intentionally split to pass multiple flags
Expand Down

0 comments on commit a3026c6

Please sign in to comment.