In Cord we notice that when working on a stack of diffs, then
sometimes spr land fails with the following error:
β GitHub Pull Request merge failed
π GitHub: At least 1 approving review is required by reviewers with write access.
Documentation URL: https://docs.github.com/articles/about-protected-branches
This problem goes away if we go to the PR and manually change the PR's
base branch to master. Then spr land works fine. This is surprising
because in the PR history I can see that spr changed the base branch to
master too when we tried to spr land the first time.
I initially added a 5s sleep call, and the problem went away. Hence, I
suspect this is an issue on GitHub's end. Hence, I added a retry
mechanism around the API call.
I added a utility function do_with_retry() to do this. Not as much for
code re-use, but because it makes the code easier to read IMO. There is
code above my changes that also uses retries, but I did not refactor it
to use do_with_retry() because that code looked more complex π
Test Plan: I will be using spr with this change for the next few days
In Cord we notice that when working on a stack of diffs, then sometimes
spr land
fails with the following error:This problem goes away if we go to the PR and manually change the PR's base branch to master. Then
spr land
works fine. This is surprising because in the PR history I can see that spr changed the base branch to master too when we tried tospr land
the first time.I initially added a 5s sleep call, and the problem went away. Hence, I suspect this is an issue on GitHub's end. Hence, I added a retry mechanism around the API call.
I added a utility function
do_with_retry()
to do this. Not as much for code re-use, but because it makes the code easier to read IMO. There is code above my changes that also uses retries, but I did not refactor it to usedo_with_retry()
because that code looked more complex πTest Plan: I will be using spr with this change for the next few days