From 86625cc217cfa92e2c580741486b0bf4d3db9c28 Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 6 Dec 2021 12:18:46 +0100 Subject: [PATCH] Merged the input commit description if statement --- entrypoint.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 82b8c4a..dbb5dd5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -113,15 +113,6 @@ if _git_changed; then git add "${INPUT_FILE_PATTERN}" || echo "Problem adding your files with pattern ${INPUT_FILE_PATTERN}" fi - # Check if the commit description was populated - IF_COMMIT_DESC="" - if [ "$INPUT_COMMIT_DESCRIPTION" != "" ] - then - IF_COMMIT_DESC=" -m '$INPUT_COMMIT_DESCRIPTION'" - else - IF_COMMIT_DESC="" - fi - # Commit and push changes back if $INPUT_SAME_COMMIT; then echo "Amending the current commit..." @@ -129,7 +120,12 @@ if _git_changed; then git commit --amend --no-edit git push origin -f else - git commit -m "$INPUT_COMMIT_MESSAGE" $IF_COMMIT_DESC --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} || echo "No files added to commit" + if [ "$INPUT_COMMIT_DESCRIPTION" != "" ] + then + git commit -m "$INPUT_COMMIT_MESSAGE" -m $INPUT_COMMIT_DESCRIPTION --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} || echo "No files added to commit" + else + 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 ${INPUT_PUSH_OPTIONS:-} fi echo "Changes pushed successfully."