From 5a36d3f1fad25ccc4023b54777b1e287ca45db66 Mon Sep 17 00:00:00 2001 From: mqxter Date: Tue, 17 Feb 2026 18:33:20 +0200 Subject: [PATCH] this is better i think --- .../shared-actions/tag-versions/action.yaml | 54 +++++-------------- 1 file changed, 14 insertions(+), 40 deletions(-) diff --git a/.github/shared-actions/tag-versions/action.yaml b/.github/shared-actions/tag-versions/action.yaml index cb9f575..0e91719 100644 --- a/.github/shared-actions/tag-versions/action.yaml +++ b/.github/shared-actions/tag-versions/action.yaml @@ -128,52 +128,26 @@ runs: - name: Commit version to AppState shell: bash working-directory: appState + if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.run_attempt == 1 }} run: | git config user.name "${{ github.actor }}" git config user.email "${{ github.actor}}@users.noreply.github.com" git add . - if ! git diff --cached --exit-code; then - git commit -m "Update appVersion in AppState with ${{ inputs.current_tag }}" - - MAX_RETRIES=5 - RETRY_COUNT=0 - PUSH_SUCCESS=false - - while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do - # If a previous attempt left a rebase in-progress, abort it so we can retry cleanly. - git rebase --abort >/dev/null 2>&1 || true - - git fetch origin - if ! git rebase origin/master; then - echo "Rebase failed (likely due to parallel updates). Aborting rebase and retrying..." - git rebase --abort >/dev/null 2>&1 || true - RETRY_COUNT=$((RETRY_COUNT + 1)) - if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then - sleep $((2 ** RETRY_COUNT)) - fi - continue - fi - - if git push origin master; then - PUSH_SUCCESS=true - echo "Successfully pushed to AppState repository" - break - else - RETRY_COUNT=$((RETRY_COUNT + 1)) - if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then - echo "Push failed, retrying ($RETRY_COUNT/$MAX_RETRIES)..." - sleep $((2 ** RETRY_COUNT)) # Exponential backoff: 2, 4, 8, 16 seconds - fi - fi - done - - if [ "$PUSH_SUCCESS" = false ]; then - echo "Failed to push after $MAX_RETRIES attempts" - exit 1 - fi - else + if git diff --cached --exit-code; then echo "No changes to commit" + exit 0 fi + git commit -m "Update appVersion in AppState with ${{ inputs.current_tag }}" + for i in {1..4}; do + git fetch origin + if git rebase origin/master && git push origin master; then + exit 0 + fi + git rebase --abort 2>/dev/null || true + sleep 2 + done + echo "Failed to push after 4 attempts" + exit 1 - name: Tag github repository with venv Tag working-directory: code