Add Watchers When Submitting a Pull Request (But Not Also Reviewers)

One of my development teams wants to be able to have certain people be notified (watchers) for a pull request BUT NOT by making them reviewers. I don't know that the necessary care about it being automatic, but they'd like to be able to add watchers when submitting a pull request.

 

Does anyone know if there's a way to do this out of the box or with a Stash add-on? We're on 2.12.3 by the way.

2 answers

There is no built-in functionality or existing plug-in for this, but you can create a very simple plugin to listen to PullRequestOpenedEvent and add the required people as watchers. More info here.

The main part of the code would be something like this:

@EventListener
public void OpenedListener(final PullRequestOpenedEvent openedEvent)
{
    Set<Watcher> watchers = openedEvent.getPullRequest().getWatchers();
    watchers.add(...)
}

[I am not completely sure about the watchers.add() part (whether this would actually affect the pull request). If somebody has actually tried this, please confirm/correct.]

The use case for this is that pull requests can be used to learn/teach other team members about certain things to look out for when coding as well as being involved in making comments to the changes. It would be great to allow watchers/non-reviewer participants to be added during pull request creation.

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 ...

451 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