mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-16 05:10:31 +02:00
Merge pull request #27 from jorenbroekema/fix/commit
fix: add commit and push logic after git add logic
This commit is contained in:
@@ -48,6 +48,17 @@ if _git_changed; then
|
|||||||
else
|
else
|
||||||
# Calling method to configure the git environemnt
|
# Calling method to configure the git environemnt
|
||||||
_git_setup
|
_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
|
# Commit and push changes back
|
||||||
if $INPUT_SAME_COMMIT; then
|
if $INPUT_SAME_COMMIT; then
|
||||||
echo "Amending the current commit..."
|
echo "Amending the current commit..."
|
||||||
@@ -55,15 +66,6 @@ if _git_changed; then
|
|||||||
git commit --amend --no-edit
|
git commit --amend --no-edit
|
||||||
git push origin -f
|
git push origin -f
|
||||||
else
|
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 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
|
||||||
|
|||||||
Reference in New Issue
Block a user