Hi!
I'm working on a small Bitbucket App which would ensure PRs targeting `master` have a `merge --no-ff` strategy.
My app listens to `avi:bitbucket:created:pullrequest` events and updates the pull request if target = `master`.
It seems to work as I do not get any errors (I also update the title to make sure my PUT request is fine).
However when I click on `Merge` I still have the complete list of merge strategies and not the one I set earlier.
Any pointers as to why I can't have just one merge strategy in the Merge modal?
Here's the code which updates `title` but not `merge_strategies`.
const updatePr = async (workspaceId, repoId, prId) => { const requestUrl = route`/2.0/repositories/${workspaceId}/${repoId}/pullrequests/${prId}`; let response = await api.asApp().requestBitbucket(requestUrl, { method: "PUT", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ title: 'This is an updated title.', destination: { branch: { merge_strategies: [ 'merge_commit' ] } } }), }); return response.json(); };
Thanks!
comment removed since I posted code in my original post.
I don't think this is supported. Did you base this on any documentation? I know you can set the default merge strategy at a repository level, ut not restrict the merge strategies, let alone for the PR.
We actually support this specifically in our app. Using Flowie you can set the merge strategy based on multiple conditions, including the target, like in your example. You can set the other options too, like the to close or not close. You can define them as default or lock them.
Regards,
Renato
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I read the Rest API documentation (PUT to update a PR) and this is what can be sent in the body:
Is that what you guys use?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is that what you guys use?
No, Flowie has its own implementation to support it.
I believe this is just a description of pull request properties, not necessarily what can be changed. For instance, you can't update id or links even though they are listed above as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jools,
I didn't see your code yesterday (perhaps you edited the post after I read it?).
Saxea _Flowie_ is actually right, you cannot change the available merge strategies with this API endpoint.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Theodora Boudale .
Thank you for confirming. Is there an API endpoint which would let me do what I want? Or at least a way to limit via coe the entries in the merge strategies drop down?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jools,
I haven't been involved with app development so I don't know the reason why. However, I suggest posting your question either to the developer community:
Or, if this is a Forge app, in the 'Forge for Bitbucket Cloud' group here:
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Theodora Boudale
I'll wait a couple of days to see if anyone chimes in with a solution or pointers and then I'll post in the Forge section. Maybe @Edmund Munday knows as he's active in the forums you mentioned?
Thanks.
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.