"Squash & Merge Pull Request" via the GraphQL API


I’m just starting to explore the GraphQL api. One thing I had hoped to do was to be able to squash & merge a PR. The only relevant mutation mentioned in the docs is mergePullRequest, which will do just that: create a merge commit for the PR. 

I disabled both Merge and Rebase in my repo, thinking that if Squash was the only option, then the API would squash. Instead, I got this error message:

> “message”: “Merge commits are not allowed on this repository.”

That does make sense, since I had disabled merge commits, but it’s not what I was hoping for.

I can’t find any parameter for mergePullRequest that allows me to request a squash. Is this possible through the API?

Thanks for any help.

  • David

No, that currently isn’t possible via the GraphQL API. You’ll have to use the REST endpoint for now.

I hope that helps!