Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

"Squash & Merge Pull Request" via the GraphQL API

Hi,

 

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

1 Reply
Community Manager
Message 2 of 2

Re: "Squash & Merge Pull Request" via the GraphQL API

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

 

I hope that helps!