Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Retry push until successful (#208)

merwanehamadi86f73dab6856
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fde364f85e..530bd62d45 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 }}