From a9474e2eb85c58c44fed4cf41e4d856e3ba1d42e Mon Sep 17 00:00:00 2001 From: insyri <60794909+insyri@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:46:31 -0500 Subject: [PATCH 1/6] Corrected if/else for INPUT_COMMIT_DESCRIPTION. --- entrypoint.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7a764a4..dcb1037 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -113,6 +113,15 @@ 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..." @@ -120,7 +129,7 @@ if _git_changed; then git commit --amend --no-edit git push origin -f else - git commit -m "$INPUT_COMMIT_MESSAGE" if [ "$INPUT_COMMIT_DESCRIPTION" != "" ]; then echo '-m "$INPUT_COMMIT_DESCRIPTION"' fi --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} || echo "No files added to commit" + 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" git push origin ${INPUT_PUSH_OPTIONS:-} fi echo "Changes pushed successfully." From f44961013c38b3cfc3f0693ac5a57e35290ccd24 Mon Sep 17 00:00:00 2001 From: insyri <60794909+insyri@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:58:13 -0500 Subject: [PATCH 2/6] Variable assignment fix, issued via CodeFactor --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index dcb1037..36239e4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -117,9 +117,9 @@ if _git_changed; then IF_COMMIT_DESC="" if [ "$INPUT_COMMIT_DESCRIPTION" != "" ] then - $IF_COMMIT_DESC=" -m '$INPUT_COMMIT_DESCRIPTION'" + IF_COMMIT_DESC=" -m '$INPUT_COMMIT_DESCRIPTION'" else - $IF_COMMIT_DESC="" + IF_COMMIT_DESC="" fi # Commit and push changes back From f9f10e071920f54d9d3b3ba82546263393efba5d Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 6 Dec 2021 12:11:52 +0100 Subject: [PATCH 3/6] Added spacing for commit description --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 36239e4..fba513b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -129,7 +129,7 @@ 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" + 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" git push origin ${INPUT_PUSH_OPTIONS:-} fi echo "Changes pushed successfully." From fdbbee356782dce9651e019ed07e4d44999efb0e Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 6 Dec 2021 12:15:24 +0100 Subject: [PATCH 4/6] Bugfix for the commit description --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index fba513b..82b8c4a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -129,7 +129,7 @@ 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" + 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" git push origin ${INPUT_PUSH_OPTIONS:-} fi echo "Changes pushed successfully." From 86625cc217cfa92e2c580741486b0bf4d3db9c28 Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 6 Dec 2021 12:18:46 +0100 Subject: [PATCH 5/6] 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." From 26c489217918dbfb2f743734285e8cacf3960d88 Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 6 Dec 2021 12:22:36 +0100 Subject: [PATCH 6/6] Fixed a bug with missing " --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index dbb5dd5..ec6b2da 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -122,7 +122,7 @@ if _git_changed; then else 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" + 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