From 58a28dd81ebfc9477a9506450b5fbf29c5962274 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Sat, 15 Aug 2026 17:46:45 +0200 Subject: [PATCH] retry i18n auto-commit on push race --- .github/workflows/build-i18n-messages.yml | 22 ++++++++++++++++++- .github/workflows/build-translation-cache.yml | 21 +++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-i18n-messages.yml b/.github/workflows/build-i18n-messages.yml index 8152b699..392de3b5 100644 --- a/.github/workflows/build-i18n-messages.yml +++ b/.github/workflows/build-i18n-messages.yml @@ -115,4 +115,24 @@ jobs: Source: ${GITHUB_SHA::7} Triggered by: ${{ github.event_name }}" - git push origin develop + # Rebase-and-retry against develop: between the initial + # checkout and this push another workflow (e.g. + # build-translation-cache auto-commit) or a manual push can + # land on develop first, and a naked push fails with + # non-fast-forward — losing the freshly generated translation + # commit. Rebasing the local i18n commit on top of the newer + # HEAD is safe: paths don't overlap with cache/script + # workflows, and the same-branch collisions between two i18n + # runs are already blocked by the concurrency group above. + for attempt in 1 2 3 4 5; do + git fetch origin develop + if git rebase origin/develop && git push origin develop; then + echo "push succeeded on attempt ${attempt}" + exit 0 + fi + echo "push attempt ${attempt} failed, retrying..." + git rebase --abort 2>/dev/null || true + sleep $(( attempt * 3 )) + done + echo "push failed after 5 attempts" + exit 1 diff --git a/.github/workflows/build-translation-cache.yml b/.github/workflows/build-translation-cache.yml index 9ed029d1..aa3f67fe 100644 --- a/.github/workflows/build-translation-cache.yml +++ b/.github/workflows/build-translation-cache.yml @@ -96,4 +96,23 @@ jobs: Source: ${GITHUB_SHA::7} Triggered by: ${{ github.event_name }}" - git push origin develop + # Rebase-and-retry against develop: between the initial + # checkout and this push another workflow (e.g. + # build-i18n-messages auto-commit) or a manual push can land + # on develop first, and a naked push fails with + # non-fast-forward — losing the freshly built cache commit. + # Paths don't overlap with the other workflows, and + # same-branch collisions between two cache runs are already + # blocked by the concurrency group. + for attempt in 1 2 3 4 5; do + git fetch origin develop + if git rebase origin/develop && git push origin develop; then + echo "push succeeded on attempt ${attempt}" + exit 0 + fi + echo "push attempt ${attempt} failed, retrying..." + git rebase --abort 2>/dev/null || true + sleep $(( attempt * 3 )) + done + echo "push failed after 5 attempts" + exit 1