From fe3ac05a3e3b177d84b34eada680c4211f592ceb Mon Sep 17 00:00:00 2001 From: "Dumas, Taylor" Date: Wed, 6 Jan 2021 09:22:38 -0600 Subject: [PATCH] fail action if cdk subcommand exits with non-zero exit code --- entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index e5942e3..d1ef21a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,8 +68,11 @@ function runCdk(){ echo "${output}" commentStatus="Failed" - if [ "${exitCode}" == "0" -o "${exitCode}" == "1" ]; then + if [ "${exitCode}" == "0" ]; then commentStatus="Success" + elif [ "${exitCode}" != "0" ]; then + echo "CDK subcommand ${INPUT_CDK_SUBCOMMAND} for stack ${INPUT_CDK_STACK} has failed. See above console output for more details." + exit 1 fi if [ "$GITHUB_EVENT_NAME" == "pull_request" ] && [ "${INPUT_ACTIONS_COMMENT}" == "true" ]; then