From fc2271f84a3652910345ed3090443f5525a1f7b1 Mon Sep 17 00:00:00 2001 From: peperoncino <2wua4nlyi@gmail.com> Date: Sun, 13 Jun 2021 17:19:48 +0900 Subject: [PATCH] add fail_on_error input --- README.md | 4 ++++ action.yml | 3 +++ entrypoint.sh | 10 +++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 619d029..24a975e 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ e.g. `.git/*` Optional. Filtering mode for the reviewdog command `[added,diff_context,file,nofilter]`. Default: `added`. +### `fail_on_error` + +Optional. Exit code for reviewdog when errors are found [true,false]. Default: `false`. + ## Example usage ### [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml) diff --git a/action.yml b/action.yml index 0d7d878..8ea9f57 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,9 @@ inputs: filter_mode: description: "Filtering mode for the reviewdog command [added,diff_context,file,nofilter]." default: 'added' + fail_on_error: + description: "Exit code for reviewdog when errors are found [true,false]." + default: 'false' runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 5ad8e60..d6f4401 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,4 +6,12 @@ export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" find "${INPUT_PATH:-'.'}" -not -path "${INPUT_EXCLUDE}" -type f -name "${INPUT_PATTERN:-'*'}" -print0 \ | xargs -0 misspell -locale="${INPUT_LOCALE}" -i "${INPUT_IGNORE}" \ - | reviewdog -efm="%f:%l:%c: %m" -filter-mode="${INPUT_FILTER_MODE:-added}" -name="misspell" -reporter="${INPUT_REPORTER:-github-pr-check}" -level="${INPUT_LEVEL}" + | reviewdog -efm="%f:%l:%c: %m" \ + -filter-mode="${INPUT_FILTER_MODE:-added}" \ + -name="misspell" \ + -reporter="${INPUT_REPORTER:-github-pr-check}" \ + -level="${INPUT_LEVEL}" \ + -fail-on-error="${INPUT_FAIL_ON_ERROR}" +exit_code=$? + +exit $exit_code