From b9b49851f1bbd3bad3d1f535bc3ade576a3970a9 Mon Sep 17 00:00:00 2001 From: Samuel El-Borai Date: Fri, 1 May 2020 20:39:42 +0200 Subject: [PATCH] Should fail if error found --- entrypoint.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 45eb8f4..5824e37 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e if [ -n "${GITHUB_WORKSPACE}" ]; then @@ -7,5 +7,11 @@ fi export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" +# 1. First check for warnings, should not exit with fail code when warnings found # shellcheck disable=SC2086 -dub lint --root="${INPUT_PATH:-PWD}" ${INPUT_DUB_FLAGS} -- ${INPUT_FLAGS} | reviewdog -efm="%f(%l:%c)[%tarn]: %m" -efm="%f(%l:%c)[%trror]: %m" -name="dscanner" -reporter="${INPUT_REPORTER}" -level="${INPUT_LEVEL}" +dub lint ${INPUT_DUB_FLAGS} --root="${INPUT_PATH:-PWD}" -- ${INPUT_FLAGS} | reviewdog -efm="%f(%l:%c)[%tarn]: %m" -name="dscanner" -reporter="${INPUT_REPORTER}" -level="${INPUT_LEVEL}" + +# 2. Then check for errors, if an error is found we should exit in error +set -euox pipefail # i.e: enable strict mode +# shellcheck disable=SC2086 +dub lint ${INPUT_DUB_FLAGS} --root="${INPUT_PATH:-PWD}" -- ${INPUT_FLAGS} | reviewdog -efm="%f(%l:%c)[%trror]: %m" -name="dscanner" -reporter="${INPUT_REPORTER}" -level="${INPUT_LEVEL}"