Is it possible to prompt the user during the creation of a Pull Request?

Our current workflow involves using Pull Requests for Code Reviews of commits that are going in to our main line.  The expectation is that the developer has compiled and tested the code locally before creating a Pull Request.  I would like to make this expectation explicit by adding a small checkbox to the Pull Request creation page, asking the user to confirm that they have completed testing.  Is this possible with a plugin or some other way?

3 answers

1 accepted

1 vote
Accepted answer
Adam Ahmed Atlassian Team May 12, 2016

You can plug into that page with a <form-fragment> plugin. This kind of plugin is something we thought we could improve on, so we never actually documented it, but it's there and I don't really see us getting rid of it anytime soon. Given the location isn't documented though, I can't promise we wouldn't remove that plugin location in a minor release.

The location you'd hook into is "bitbucket.page.createPullRequest", and you can trace back the <form-fragment> element in https://bitbucket.org/atlassian/stash-auto-unapprove-plugin/src/26996bfcd6d1acc055487241cbfa4fc85503670d/src/main/resources/atlassian-plugin.xml?at=master&fileviewer=file-view-default to see an example of how FormFragments can be used (note the context available will be different for the createPullRequest location than what the auto-unapprove plugin is using). essentially you are pretending that you are adding fields to the form to be submitted along with the form and handled by your plugin. But actually, you could just render whatever notice you want, and ignore any input validation / handling.

There's no more straightforward plugin point on that page, unfortunately.

Cheers,

Adam

I don't know any add-on that will do that.

I, however found that it's more effective to educate your users on what needs to be done beforehand.

I agree with Gabrielle... checkboxes that you must check, just become an, err, box-checking exercise... they become part of muscle memory so soon have no value at all.

Another way of accomplishing something similar is auto-adding a task to the PR - https://scriptrunner.adaptavist.com/latest/bitbucket/StashEventHandlers.html#_add_tasks_to_new_pull_requests . Then you have a merge check that prevents merge if there are uncompleted tasks.

But that's interesting about form fragments... sounds useful.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

433 views 6 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you