From 527f15c63469631bad24d462319b34b86d2d2f77 Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 16 Mar 2020 15:55:22 +0100 Subject: [PATCH] Added hard break for dry mode --- entrypoint.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ea4bf0e..27e2e6a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,19 +44,23 @@ echo "Files:" prettier $INPUT_PRETTIER_OPTIONS # To keep runtime good, just continue if something was changed -if ! $INPUT_DRY && _git_changed; +if _git_changed; then - # Calling method to configure the git environemnt - _git_setup - echo "Commiting and pushing changes..." - # Switch to the actual branch - git checkout $INPUT_BRANCH || echo "Problem checking out the specified branch: $INPUT_BRANCH" - # Add changes to git - git add "${INPUT_FILE_PATTERN}" || echo "Problem adding your files with pattern ${INPUT_FILE_PATTERN}" - # Commit and push changes back - git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} - _git_push - echo "Changes pushed successfully." + if $INPUT_DRY; then + exit 1 + else + # Calling method to configure the git environemnt + _git_setup + echo "Commiting and pushing changes..." + # Switch to the actual branch + git checkout $INPUT_BRANCH || echo "Problem checking out the specified branch: $INPUT_BRANCH" + # Add changes to git + git add "${INPUT_FILE_PATTERN}" || echo "Problem adding your files with pattern ${INPUT_FILE_PATTERN}" + # Commit and push changes back + git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} + _git_push + echo "Changes pushed successfully." + fi else echo "Nothing to commit. Exiting." fi