fix: add commit and push logic after git add logic

This commit is contained in:
jorenbroekema
2020-10-18 14:26:33 +02:00
parent e0055a4878
commit 30127fcc3c

View File

@@ -48,6 +48,17 @@ if _git_changed; then
else
# Calling method to configure the git environemnt
_git_setup
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..."
@@ -55,15 +66,6 @@ if _git_changed; then
git commit --amend --no-edit
git push origin -f
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"
git push origin
fi