push-to-pull-request: Wait for GitHub background update before merge.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-03 12:07:06 -08:00 committed by Tim Abbott
parent b8f57fa6bb
commit 4bcf7131c1
1 changed files with 12 additions and 0 deletions

View File

@ -142,5 +142,17 @@ if [ -n "$tracking_ref" ]; then
fi
if [ "$merge" ]; then
tries=10
sha="$(git rev-parse @)"
while
out=$(git ls-remote -- "$remote" "refs/pull/$pr_id/head")
[ "$out" != "$sha refs/pull/$pr_id/head" ]
do
if ! ((--tries)); then
echo 'error: Push was not observed in PR' >&2
exit 1
fi
sleep 1
done
git push -- "$remote" "@:$pr_base_ref"
fi