Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 14 additions & 40 deletions .github/shared-actions/tag-versions/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down