From f5f36f26c28b7721b922e5013aa3ce50ea826c77 Mon Sep 17 00:00:00 2001 From: mongolyy Date: Thu, 9 Jan 2025 02:18:17 +0900 Subject: [PATCH 1/4] add `-fail-level` support --- README.md | 6 ++++++ action.yml | 8 ++++++++ script.sh | 1 + 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 625c9aa..5569c15 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,12 @@ 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] diff --git a/action.yml b/action.yml index d23a38e..bc00efb 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,13 @@ 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]. + 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] @@ -61,6 +68,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 }} diff --git a/script.sh b/script.sh index fc2343d..4460047 100755 --- a/script.sh +++ b/script.sh @@ -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 From 7ae5ec553bbedd47a6ad04eb90502aa6b030edb0 Mon Sep 17 00:00:00 2001 From: mongolyy Date: Thu, 9 Jan 2025 02:33:01 +0900 Subject: [PATCH 2/4] add deprecation message --- README.md | 1 + action.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 5569c15..d98dd64 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ inputs: 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' diff --git a/action.yml b/action.yml index bc00efb..0950266 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,7 @@ inputs: 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: From 36a546fa8a1da6ce3d4f8c66a052d09c04c948d8 Mon Sep 17 00:00:00 2001 From: mongolyy Date: Thu, 9 Jan 2025 02:49:12 +0900 Subject: [PATCH 3/4] shfmt needs 1.22 or later. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6607f5e..59481a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 . From c17dcbbf073cc97ccb18149aa81b0d6c89be2eb2 Mon Sep 17 00:00:00 2001 From: mongolyy Date: Sun, 12 Jan 2025 21:23:47 +0900 Subject: [PATCH 4/4] Update action.yml Co-authored-by: Masaya Suzuki <15100604+massongit@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0950266..85e29a4 100644 --- a/action.yml +++ b/action.yml @@ -23,7 +23,7 @@ inputs: 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]. + 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"