@@ -454,15 +454,22 @@ jobs:
454454 msg="$msg - ${{ github.event.inputs.commit_message }}"
455455 fi
456456 git commit -m "$msg"
457+ git config http.version HTTP/1.1
457458 max_attempts=3
458459 attempt=1
459460 until [ $attempt -gt $max_attempts ]; do
460461 echo "Attempt $attempt: rebase + push"
461462 if git pull --rebase origin "${{ github.ref_name }}"; then
463+ local_sha="$(git rev-parse HEAD)"
462464 if git push origin HEAD:"${{ github.ref_name }}"; then
463465 echo "Push succeeded"
464466 break
465467 fi
468+ remote_sha="$(git ls-remote origin "refs/heads/${{ github.ref_name }}" | awk '{print $1}' || true)"
469+ if [ -n "${remote_sha}" ] && [ "${remote_sha}" = "${local_sha}" ]; then
470+ echo "Remote branch already points at ${local_sha}; treating push as successful."
471+ break
472+ fi
466473 else
467474 echo "Rebase failed; aborting and retrying"
468475 git rebase --abort || true
@@ -593,15 +600,22 @@ jobs:
593600 msg="$msg - ${{ github.event.inputs.commit_message }}"
594601 fi
595602 git commit -m "$msg"
603+ git config http.version HTTP/1.1
596604 max_attempts=3
597605 attempt=1
598606 until [ $attempt -gt $max_attempts ]; do
599607 echo "Attempt $attempt: rebase + push"
600608 if git pull --rebase origin "${{ github.ref_name }}"; then
609+ local_sha="$(git rev-parse HEAD)"
601610 if git push origin HEAD:"${{ github.ref_name }}"; then
602611 echo "Push succeeded"
603612 break
604613 fi
614+ remote_sha="$(git ls-remote origin "refs/heads/${{ github.ref_name }}" | awk '{print $1}' || true)"
615+ if [ -n "${remote_sha}" ] && [ "${remote_sha}" = "${local_sha}" ]; then
616+ echo "Remote branch already points at ${local_sha}; treating push as successful."
617+ break
618+ fi
605619 else
606620 echo "Rebase failed; aborting and retrying"
607621 git rebase --abort || true
@@ -710,15 +724,22 @@ jobs:
710724 msg="$msg - ${{ github.event.inputs.commit_message }}"
711725 fi
712726 git commit -m "$msg"
727+ git config http.version HTTP/1.1
713728 max_attempts=3
714729 attempt=1
715730 until [ $attempt -gt $max_attempts ]; do
716731 echo "Attempt $attempt: rebase + push"
717732 if git pull --rebase origin "${{ github.ref_name }}"; then
733+ local_sha="$(git rev-parse HEAD)"
718734 if git push origin HEAD:"${{ github.ref_name }}"; then
719735 echo "Push succeeded"
720736 break
721737 fi
738+ remote_sha="$(git ls-remote origin "refs/heads/${{ github.ref_name }}" | awk '{print $1}' || true)"
739+ if [ -n "${remote_sha}" ] && [ "${remote_sha}" = "${local_sha}" ]; then
740+ echo "Remote branch already points at ${local_sha}; treating push as successful."
741+ break
742+ fi
722743 else
723744 echo "Rebase failed; aborting and retrying"
724745 git rebase --abort || true
0 commit comments