Problem Merging Pull Requests


Is merging pull request functionality properly supported for GitHub apps?

i.e. PUT /repos/:owner/:repo/pulls/:number/merge

The existence of this topic implies it is: Pull requests open after merge

However, Pull Request merging is not explicitly listed under Available Endpoints here:

My app is receiving a response of 405 Method Not Allowed but not with the error message “Pull Request is not mergeable” as mentioned in

Note: same code works fine if used with a Personal Access Token


My app has Read & write access to “Contents” and “Pull Requests”. Here’s a debug of the permissions for the particular installation I’m trying with: "permissions":{"contents":"write","pull_requests":"write","metadata":"read","statuses":"read"}

I found a reference to merging here:

It’s listed as PUT /repositories/:repository_id/pulls/:id/merge instead of PUT /repos/:owner/:repo/pulls/:number/merge


I have resolved this - it was unrelated to any Merge permissions. The root cause happened to be that the allow_xxxxxx merge flags are not being provided in the repo JSON and hence an incorrect type of PR merge was being attempted.


Thanks for letting us know that you resolved this, @rarkins :+1:

For any future reports like these, please include curl -v outputs ( or equivalent logs (full HTTP request and response pairs, including all headers and bodies) for API calls which clearly demonstrate the behavior you describe. It’s often hard to provide advice and investigate without those details (i.e. with just a general description of the problem), so it’d be helpful you could provide those. Just make sure authentication credentials are masked in curl -v or the logs. :v:


Seeing as it’s on-topic, there does still seem to exist a problem with GitHub Apps merging Pull Requests. It happens only on Organizations when the “Restrict who can push to this branch” setting is enabled. In short: there’s no way to give an app permission to push, so if this setting is enabled, GitHub Apps cannot perform Pull Request merges.


Thank you @rarkins, we’ll investigate.