As part of the CI/CD pipeline, we want to validate whether a PR passes configured merge checks and is not in any conflict. I went through the cloud Rest documentation, but didn't find any api.
I see bitbucket ui makes a api call to /merge-restriction to get this info. Is there a similar api to consume?
If not what other alternatives I have to check whether a PR can be merged or not?
Hello @Siddharth Agrawal and welcome to the Community!
I'm afraid that for pull request merge check status in particular, Bitbucket Cloud currently doesn't expose a public API endpoint. We do have an open feature request to make this information available on the API, which you can find below :
I would suggest you to add your Vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a Watcher in case you want to receive first-hand updates from that ticket.
For getting the PR diff conflicts though, our development team is working on building a direct endpoint to fetch that information, but in the meanwhile you can use the Get Pull Request API endpoint to get the PR, and use the source and destination commit data to construct a direct diffstat request which will return the conflict status as part of the object.
Hope that helps! If you have any questions, please let us know.
Thank you, @Siddharth Agrawal !
Patrik S
Depending on what you are trying to do you should be able to achieve with Flowie, and if not, I'm happy to discuss and possibly add support for it.
Are you trying to run a pipeline only if certain conditions are met? E.g. only build after a review is complete?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.