This is an automated email from the ASF dual-hosted git repository. jamesfredley pushed a commit to branch fix/deploy-push-retry in repository https://gitbox.apache.org/repos/asf/grails-github-actions.git
commit c4a92cfc3b1604cafde5e853f7a8d7e320e3f655 Author: James Fredley <[email protected]> AuthorDate: Sat Mar 21 14:51:43 2026 -0400 fix: drop unnecessary 2>&1 redirect and add backoff with jitter between push retries Remove the unnecessary stderr redirect on git push (only exit code matters for the if-condition). Add incremental backoff with jitter between retry attempts to reduce collision probability when multiple concurrent jobs race to push. Assisted-by: Claude Code <[email protected]> --- deploy-github-pages/entrypoint.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deploy-github-pages/entrypoint.sh b/deploy-github-pages/entrypoint.sh index 01eaa2b..6caa7e7 100755 --- a/deploy-github-pages/entrypoint.sh +++ b/deploy-github-pages/entrypoint.sh @@ -321,7 +321,7 @@ MAX_PUSH_ATTEMPTS=5 PUSH_ATTEMPT=1 while [ $PUSH_ATTEMPT -le $MAX_PUSH_ATTEMPTS ]; do echo "Push attempt ${PUSH_ATTEMPT}/${MAX_PUSH_ATTEMPTS}" - if git push "${GIT_REPO_URL}" "${DOCUMENTATION_BRANCH}" 2>&1; then + if git push "${GIT_REPO_URL}" "${DOCUMENTATION_BRANCH}"; then echo "Deployment successful!" break fi @@ -330,7 +330,10 @@ while [ $PUSH_ATTEMPT -le $MAX_PUSH_ATTEMPTS ]; do exit 1 fi echo "Push rejected, pulling remote changes and retrying..." - git pull --rebase "${GIT_REPO_URL}" "${DOCUMENTATION_BRANCH}" PUSH_ATTEMPT=$((PUSH_ATTEMPT + 1)) + BACKOFF=$(( (PUSH_ATTEMPT * 2) + (RANDOM % 3) )) + echo "Waiting ${BACKOFF}s before retry..." + sleep $BACKOFF + git pull --rebase "${GIT_REPO_URL}" "${DOCUMENTATION_BRANCH}" done echo "::endgroup::"
