diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml index bf407ab..8424e58 100644 --- a/.github/workflows/update-readme.yml +++ b/.github/workflows/update-readme.yml @@ -20,8 +20,10 @@ jobs: template: "templates/README.md.tpl" writeTo: "profile/README.md" - - uses: stefanzweifel/git-auto-commit-action@v7.1.0 + - name: Commit changes + id: auto-commit if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + uses: stefanzweifel/git-auto-commit-action@v7.1.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -29,4 +31,22 @@ jobs: commit_message: "chore: Update generated README" commit_user_name: "GitHub Actions Bot" commit_user_email: "actions@github.com" - commit_author: "GitHub Actions Bot " \ No newline at end of file + commit_author: "GitHub Actions Bot " + skip_push: true + + - name: Push changes with retry + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && steps.auto-commit.outputs.changes_detected == 'true' + run: | + max_retries=3 + for attempt in $(seq 1 $max_retries); do + echo "Push attempt $attempt of $max_retries" + if git push origin main; then + echo "Push succeeded on attempt $attempt" + exit 0 + fi + echo "Push failed, pulling with rebase and retrying..." + git pull --rebase origin main + sleep $((attempt * 2)) + done + echo "Push failed after $max_retries attempts" + exit 1 \ No newline at end of file