Skip to content

Commit 6f7958a

Browse files
committed
fix: make will stop github action workflow when error on target
1 parent 2ea459a commit 6f7958a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,25 @@ AWS_SAM_ARCH ?= arm64
6060
# MAKE_DEBUG=true make <target> will print the command
6161
# MAKE_STOP_ON_ERRORS=true make any fail will stop the execution if the command fails, this is useful for CI
6262
# NOTE: if the command has a > it will print the output into the original redirect of the command
63-
MAKE_STOP_ON_ERRORS := false
64-
MAKE_DEBUG := false
63+
MAKE_STOP_ON_ERRORS ?= false
64+
MAKE_DEBUG ?= false
6565

6666
define exec_cmd
6767
$(if $(filter $(MAKE_DEBUG),true),\
6868
${1} \
6969
, \
7070
$(if $(filter $(MAKE_STOP_ON_ERRORS),true),\
71-
@ERROR_OCCURRED=0; ${1} > /dev/null || ERROR_OCCURRED=1; if [ $$ERROR_OCCURRED -eq 0 ]; then printf " 🤞 ${1} ✅\n"; else printf " ${1} ❌ 🖕\n"; exit 1; fi \
71+
@${1} > /dev/null && printf " 🤞 ${1} ✅\n" || (printf " ${1} ❌ 🖕\n"; exit 1) \
7272
, \
7373
$(if $(findstring >, $1),\
74-
@${1} 2>/dev/null && printf " 🤞 ${1} ✅\n" || printf " ${1} ❌ 🖕\n" \
74+
@${1} 2>/dev/null; _exit_code=$$?; if [ $$_exit_code -eq 0 ]; then printf " 🤞 ${1} ✅\n"; else printf " ${1} ❌ 🖕\n"; fi; exit $$_exit_code \
7575
, \
76-
@${1} > /dev/null 2>&1 && printf ' 🤞 ${1} ✅\n' || printf ' ${1} ❌ 🖕\n' \
76+
@${1} > /dev/null 2>&1; _exit_code=$$?; if [ $$_exit_code -eq 0 ]; then printf ' 🤞 ${1} ✅\n'; else printf ' ${1} ❌ 🖕\n'; fi; exit $$_exit_code \
7777
) \
7878
) \
7979
)
8080

81-
endef # don't remove the white space at the end of the line
82-
# this is a function that will execute a command and print a message
81+
endef # don't remove the white line before endef
8382

8483
###############################################################################
8584
######## Targets ##############################################################

0 commit comments

Comments
 (0)