File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,7 +146,27 @@ runs:
146146 git commit --message="ci: remove preview for ${{ steps.parse_action.outputs.path }}
147147
148148 Commit created with [EndBug/pages-preview](https://github.com/EndBug/pages-preview)" --allow-empty
149- git push origin ${{ inputs.preview_branch }}
149+
150+ # Retry loop for safe push
151+ max_attempts=5
152+ attempt=1
153+
154+ while [ $attempt -le $max_attempts ]; do
155+ echo "🔄 Attempt $attempt to push changes..."
156+ git pull --rebase origin ${{ inputs.preview_branch }} || exit 1
157+ if git push origin ${{ inputs.preview_branch }}; then
158+ echo "✅ Push successful"
159+ break
160+ fi
161+ attempt=$(( attempt + 1 ))
162+ echo "⚠️ Push failed due to concurrent changes, retrying in 3s..."
163+ sleep 3
164+ done
165+
166+ if [ $attempt -gt $max_attempts ]; then
167+ echo "❌ Failed to push after $max_attempts attempts"
168+ exit 1
169+ fi
150170
151171 - name : Check whether there has been any change in the preview repo
152172 if : ${{ steps.parse_action.outputs.action != 'none' }}
You can’t perform that action at this time.
0 commit comments