From 22d562700376018b36ef535b73f723b293d51c51 Mon Sep 17 00:00:00 2001 From: Andy Grunwald Date: Sun, 3 May 2026 15:53:37 +0200 Subject: [PATCH] ci: Make auto-commit step resilient to concurrent pushes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stefanzweifel/git-auto-commit-action does not pull or rebase before pushing (this is a deliberate non-goal upstream). When this workflow runs concurrently with other actors pushing unrelated changes to main (e.g. a different folder), the action's internal git push is rejected as non-fast-forward and the workflow fails — even though the changes do not conflict. Switch to skip_push and add a small retry loop that does git pull --rebase between push attempts, mirroring the pattern already proven in the EngineeringKiosk/podcast-metadata workflows. --- .github/workflows/podcast-data.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/podcast-data.yml b/.github/workflows/podcast-data.yml index a3f335bd..f38cb208 100644 --- a/.github/workflows/podcast-data.yml +++ b/.github/workflows/podcast-data.yml @@ -47,7 +47,9 @@ jobs: run: ./GermanTechPodcasts generateOpml --json-directory ../generated --opml-output ../podcasts.opml # Commit results back to repository - - uses: stefanzweifel/git-auto-commit-action@v7.1.0 + - name: Commit changes + id: auto-commit + uses: stefanzweifel/git-auto-commit-action@v7.1.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -56,6 +58,25 @@ jobs: commit_user_name: "GitHub Actions Bot" commit_user_email: "actions@github.com" commit_author: "GitHub Actions Bot " + skip_push: true + + - name: Push changes with retry + if: steps.auto-commit.outputs.changes_detected == 'true' + working-directory: ${{ github.workspace }} + 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 - name: Trigger webpage to sync uses: peter-evans/repository-dispatch@v4.0.1