mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-12 19:30:30 +02:00
fix: add commit and push logic after git add logic
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user