Skip to content

Commit

Permalink
Merged the input commit description if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
creyD authored Dec 6, 2021
1 parent fdbbee3 commit 86625cc
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,19 @@ 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..."
git pull
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."
Expand Down

0 comments on commit 86625cc

Please sign in to comment.