From bf27e9d676e5544f2a4fe2acc0770354ac5461a4 Mon Sep 17 00:00:00 2001 From: Conrad Date: Sat, 17 Oct 2020 20:01:43 +0200 Subject: [PATCH] Moved git amend before git add --- entrypoint.sh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9b2eb5e..978cd61 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -48,21 +48,20 @@ if _git_changed; then else # Calling method to configure the git environemnt _git_setup - echo "Commiting and pushing changes..." - if $INPUT_ONLY_CHANGED; then - for file in $(git diff --name-only HEAD^..HEAD) - do - git add $file - done - else - # Add changes to git - git add "${INPUT_FILE_PATTERN}" || echo "Problem adding your files with pattern ${INPUT_FILE_PATTERN}" - fi # Commit and push changes back if $INPUT_SAME_COMMIT; then echo "Amending the current commit..." - git commit --amend --no-edit + git commit --amend else + if $INPUT_ONLY_CHANGED; then + for file in $(git diff --name-only HEAD^..HEAD) + do + git add $file + done + else + # Add changes to git + git add "${INPUT_FILE_PATTERN}" || echo "Problem adding your files with pattern ${INPUT_FILE_PATTERN}" + fi git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} || echo "No files added to commit" fi git push origin