Skip to content

Commit

Permalink
Allow for disabling force push
Browse files Browse the repository at this point in the history
If the action is pushing to the same branch, it is likely desirable to
do a regular push instead of a force which might overwrite other
changes in case the source has changed after the action triggered.

To not break the interface of the action, add a boolean flag to turn
on 'NO_FORCE_PUSH' mode.
  • Loading branch information
UnseenWizzard committed Sep 27, 2021
1 parent 0b7888f commit e2b8455
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ git add . && \
git status && \
curr_branch="$(git rev-parse --abbrev-ref HEAD)" && \
commit_msg="${COMMIT_MSG:-'Marp Action Build'}" && \
git commit -m "${commit_msg}" && \
git push --force $remote_repo ${curr_branch}:${PUBLISH_TO_BRANCH}
git commit -m "${commit_msg}"

if [ "$NO_FORCE_PUSH" = true ]
then
git push $remote_repo ${curr_branch}:${PUBLISH_TO_BRANCH}
else
git push --force $remote_repo ${curr_branch}:${PUBLISH_TO_BRANCH}
fi

echo "✔ Pushed Successfully!"
echo ""
Expand Down

0 comments on commit e2b8455

Please sign in to comment.