I am using the Github API via Octokit and have noticed a strange behavior. In one scenario I am programatically syncing master across 2 forks. I need to:
- Open a pull request from repo1:master to repo2:master
- Merge that pull request
When I first tried this I kept seeing the error "Head branch was modified. Review and try the merge again." It turns out that simply putting a delay (5 seconds) between creating the pull request and merging it (based on PR number) avoids this error.
So, it seems that github is returning from the 'create' call before it's actually finished or something along those lines. I wonder if there is a more reliable way (not using sleeps) to ensure that the PR is ready to be merged after creation.