chdsbd / kodiak

🔮 A bot to automatically update and merge GitHub PRs
https://kodiakhq.com
GNU Affero General Public License v3.0
1.03k stars 65 forks source link

⚠️ problem contacting GitHub API with method 'pull_request/update_branch' #857

Closed tay1orjones closed 1 year ago

tay1orjones commented 1 year ago
⚠️ problem contacting GitHub API with method 'pull_request/update_branch'

We've started seeing this error more and more preventing automatic merging. I'm not sure what triggers it. Usually we can resolve it by waiting for the PR to become out of date with main and hitting the "update with main" button causing a merge commit to be added.

This PR had it happen: https://github.com/carbon-design-system/carbon-website/pull/3211

Click to expand branch protection settings ![image](https://user-images.githubusercontent.com/3360588/201771324-9edde675-6fd3-4971-8cee-04c03fb8a221.png)
chdsbd commented 1 year ago

Hey @tay1orjones,

Thanks for the report. I believe there's a recent bug introduced in the GitHub API that's causing this issue.

Here's the error message from your workflow run: https://github.com/carbon-design-system/carbon-website/runs/9484391386

{
"message":"refusing to allow a GitHub App to create or update workflow .github/workflows/platform-content-sync.yml without workflows permission",
"documentation_url":"https://docs.github.com/rest/reference/pulls#update-a-pull-request-branch"
}

The pull request you linked isn't even touching any .github/workflows/ files.

This appears to only affect forks, which is a problem mainly for open source repositories like yours. I'm currently trying to convince GitHub Support this is an issue and not expected behavior.

I'm going to try replicating this issue and see if I can find a workaround.

chdsbd commented 1 year ago

I was able to replicate the issue in the following way

  1. Fork the repository
  2. Update the main branch of the parent repository so the fork is out of date
  3. Make a change to the fork and open a pull request
  4. Attempt to merge the pull request with Kodiak and observe Kodiak seeing this error when attempting to update the branch

I think GitHub made a change that broke the /update-branch API endpoint for Forks.

Here's an old related issue: https://github.com/chdsbd/kodiak/issues/104

tay1orjones commented 1 year ago

@chdsbd This seemed to have resolved itself shortly after your investigation but now we're hitting it again

chdsbd commented 1 year ago

Hey @tay1orjones,

Thanks for the ping.

GitHub added a bug to their API that's causing this. I tried opening a ticket in October but it was archived. I've just opened another one. There's a related issue here: #853

chdsbd commented 1 year ago

This is still an issue and I'm still trying to get GitHub Support to recognize this as a bug to escalate to an engineer. I think I've given them a better reproduction step so hopefully we'll get a better response.

I'm sorry these bug has been outstanding for so long.

This issue is a duplicate of #853, so I'm going to write an update there now. Please subscribe to that issue to get updates.

chdsbd commented 1 year ago

Just to be clear, I'm working on resolving this issue and providing more foolproof reproduction steps to GitHub support, so subscribe to #853 to get updates.