Merge pull request #27 from jorenbroekema/fix/commit

fix: add commit and push logic after git add logic
This commit is contained in:
2020-10-18 15:10:33 +02:00
committed by GitHub

View File

@@ -48,13 +48,7 @@ if _git_changed; then
else else
# Calling method to configure the git environemnt # Calling method to configure the git environemnt
_git_setup _git_setup
# 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
if $INPUT_ONLY_CHANGED; then if $INPUT_ONLY_CHANGED; then
for file in $(git diff --name-only HEAD^..HEAD) for file in $(git diff --name-only HEAD^..HEAD)
do do
@@ -64,6 +58,14 @@ if _git_changed; then
# Add changes to git # Add changes to git
git add "${INPUT_FILE_PATTERN}" || echo "Problem adding your files with pattern ${INPUT_FILE_PATTERN}" git add "${INPUT_FILE_PATTERN}" || echo "Problem adding your files with pattern ${INPUT_FILE_PATTERN}"
fi 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" --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" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} || echo "No files added to commit"
git push origin git push origin
fi fi