File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9898fi
9999
100100SKIP_BRANCH_CREATION=false
101+ RESET_REQUIRES_FORCE_WITH_LEASE=false
101102if [[ -z ${FILES_CHANGED} && " ${INPUT_AMEND} " != " true" && -z " ${INPUT_TARGET_BRANCH} " ]] && ! input_true " ${INPUT_ALLOW_EMPTY_COMMIT} " ; then
102103 SKIP_BRANCH_CREATION=true
103104 BRANCH=" $( get_current_branch) "
@@ -169,6 +170,7 @@ if [[ "${SKIP_BRANCH_CREATION}" != "true" ]]; then
169170 echo " [ERROR] Failed to hard reset '${BRANCH} ' to origin/${MAIN_BRANCH} "
170171 exit 1
171172 }
173+ RESET_REQUIRES_FORCE_WITH_LEASE=true
172174 else
173175 echo " [INFO] Rebasing branch onto ${MAIN_BRANCH} ..."
174176 git rebase " origin/${MAIN_BRANCH} " || {
249251if [[ " ${INPUT_FORCE} " == " true" ]]; then
250252 echo " [INFO] Force pushing changes using --force"
251253 git push --force origin " ${BRANCH} "
252- elif [[ " ${INPUT_FORCE_WITH_LEASE} " == " true" ]]; then
253- echo " [INFO] Force pushing changes with lease"
254+ elif [[ " ${INPUT_FORCE_WITH_LEASE} " == " true" || " ${RESET_REQUIRES_FORCE_WITH_LEASE} " == " true" ]]; then
255+ if [[ " ${RESET_REQUIRES_FORCE_WITH_LEASE} " == " true" && " ${INPUT_FORCE_WITH_LEASE} " != " true" ]]; then
256+ echo " [INFO] Force pushing changes with lease (required after reset_target_branch=true)"
257+ else
258+ echo " [INFO] Force pushing changes with lease"
259+ fi
254260 git push --force-with-lease origin " ${BRANCH} "
255261elif [[ " ${SKIP_BRANCH_CREATION} " != " true" && ( -n ${FILES_CHANGED} || " ${INPUT_AMEND} " == " true" || -n " ${INPUT_TARGET_BRANCH} " ) ]]; then
256262 echo " [INFO] Pushing changes"
You can’t perform that action at this time.
0 commit comments