other: testing approach with multiple commands on fail

This commit is contained in:
Fabricio Sander
2021-03-25 21:21:06 -03:00
parent 2602a7aad8
commit 67234beef0

View File

@@ -2,7 +2,6 @@
# e is for exiting the script automatically if a command fails, u is for exiting if a variable is not set
# x would be for showing the commands before they are executed
set -eu
set -o pipefail
# FUNCTIONS
# Function for setting up git env in the docker container (copied from https://github.com/stefanzweifel/git-auto-commit-action/blob/master/entrypoint.sh)
@@ -52,14 +51,12 @@ fi
echo "Prettifying files..."
echo "Files:"
prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"
PRETTIER_RESULT=$?
prettier $INPUT_PRETTIER_OPTIONS || { PRETTIER_RESULT=$?; echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"; }
# To keep runtime good, just continue if something was changed
if _git_changed; then
if $INPUT_DRY; then
if [[ "$PRETTIER_RESULT" -eq 1 ]]; then
echo "Prettier found unpretty files!"
exit 1
else