Skip to content

Commit

Permalink
build: add a retry on git push in merge-pr.sh
Browse files Browse the repository at this point in the history
Github sometimes takes a few seconds to figure out that after a
force-push to a branch, we are still allowed to merge it to main.
So this does a sleep/retry, once, in the event that the first
push fails.
  • Loading branch information
coriolinus committed Jan 22, 2025
1 parent 1fd0f46 commit ed6a8ab
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/merge-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,13 @@ fi
# we can now actually merge this to main without breaking anything
git checkout main
git merge "$branch" --ff-only
git push

# In principle we can just push now, because we're just updating `main` to the tip of an approved branch.
# Github has magic to detect that!
# Unfortunately, the magic is sometimes laggy.
# So let's give it a shot, and if it doesn't work, we'll try again a few seconds later;
# that should minimize overall waiting.
if ! git push; then
sleep 2.5s
git push
fi

0 comments on commit ed6a8ab

Please sign in to comment.