diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fde364f8..530bd62d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -228,10 +228,23 @@ jobs: git commit -m "${commit_message}" git stash current_branch=${{ github.ref_name }} - git fetch origin $current_branch - git rebase origin/$current_branch - git push origin HEAD - poetry run python send_to_googledrive.py || echo "Failed to upload to Google Drive" + attempts=0 + max_attempts=3 + + while [ $attempts -lt $max_attempts ]; do + git fetch origin $current_branch + git rebase origin/$current_branch + if git push origin HEAD; then + echo "Success!" + poetry run python send_to_googledrive.py || echo "Failed to upload to Google Drive" + exit 0 + else + echo "Attempt $(($attempts + 1)) failed. Retrying..." + attempts=$(($attempts + 1)) + fi + done + + echo "Failed after $max_attempts attempts." env: GDRIVE_BASE64: ${{ secrets.GDRIVE_BASE64 }} GITHUB_REF_NAME: ${{ github.ref_name }}