@@ -180,13 +180,37 @@ jobs:
180180 RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
181181 echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
182182
183- # Commit and push
183+ # Commit and push with retry logic
184184 cd /tmp/searchindex-repo
185185 git config user.name "GitHub Actions"
186186 git config user.email "github-actions@github.com"
187187 git add "${FILENAME}" "${FILENAME}.gz"
188- git commit -m "Update ${FILENAME} from hacktricks-cloud build" || echo "No changes to commit"
189- git push || echo "No changes to push"
188+
189+ if git diff --staged --quiet; then
190+ echo "No changes to commit"
191+ else
192+ git commit -m "Update ${FILENAME} from hacktricks-cloud build"
193+
194+ # Retry push up to 20 times with pull --rebase between attempts
195+ MAX_RETRIES=20
196+ RETRY_COUNT=0
197+ while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
198+ if git push origin main; then
199+ echo "Successfully pushed on attempt $((RETRY_COUNT + 1))"
200+ break
201+ else
202+ RETRY_COUNT=$((RETRY_COUNT + 1))
203+ if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
204+ echo "Push failed, attempt $RETRY_COUNT/$MAX_RETRIES. Pulling and retrying..."
205+ git pull --rebase origin main
206+ sleep $((RETRY_COUNT * 2)) # Exponential backoff
207+ else
208+ echo "Failed to push after $MAX_RETRIES attempts"
209+ exit 1
210+ fi
211+ fi
212+ done
213+ fi
190214
191215 # Login in AWs
192216 - name : Configure AWS credentials using OIDC
0 commit comments