Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -fail-level support and deprecate -fail-on-error #67

Merged
merged 4 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it was still 1.20, the go install failed.

The shfmt necessary to be 1.22 or higher.
https://github.com/mvdan/sh?tab=readme-ov-file#sh

I updated it to the latest 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 [none,any,info,warning,error].
mongolyy marked this conversation as resolved.
Show resolved Hide resolved
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
Loading