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

Chas Berndt December 4, 2014

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

1 vote
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 4, 2014

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

0 votes
Marcos Mendez (AW) December 4, 2014

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
TAGS
AUG Leaders

Atlassian Community Events