Unfortunately, from the description of this documentation it is not clear how to add a comment to the pool request itself?
In 5.0, CommentService is used for this purpose, but how to do it in 4.11 without CommentService ?
@ExportAsService
@Named("PullRequestReviewerListener")
public class PullRequestReviewerListener {
@ComponentImport
private final PullRequestService pullRequestService;
@Inject
public PullRequestReviewerListener(final PullRequestService pullRequestService) {
this.pullRequestService = pullRequestService;
}
public void OnPullRequestOpen(PullRequestOpenedEvent event) {
PullRequest pr = event.getPullRequest();
Repository repository = pr.getToRef().getRepository();
Comment newComment = pullRequestService.addComment(repository.getId(), pr.getId(), "Comment text");
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.