diff --git a/src/main/scala/app/PullRequestsController.scala b/src/main/scala/app/PullRequestsController.scala index 365fb92..d4787e1 100644 --- a/src/main/scala/app/PullRequestsController.scala +++ b/src/main/scala/app/PullRequestsController.scala @@ -18,13 +18,14 @@ import org.slf4j.LoggerFactory import org.eclipse.jgit.merge.MergeStrategy import org.eclipse.jgit.errors.NoMergeBaseException +import service.WebHookService.WebHookPayload class PullRequestsController extends PullRequestsControllerBase - with RepositoryService with AccountService with IssuesService with PullRequestService with MilestonesService with ActivityService + with RepositoryService with AccountService with IssuesService with PullRequestService with MilestonesService with ActivityService with WebHookService with ReferrerAuthenticator with CollaboratorsAuthenticator trait PullRequestsControllerBase extends ControllerBase { - self: RepositoryService with AccountService with IssuesService with MilestonesService with ActivityService with PullRequestService + self: RepositoryService with AccountService with IssuesService with MilestonesService with ActivityService with PullRequestService with WebHookService with ReferrerAuthenticator with CollaboratorsAuthenticator => private val logger = LoggerFactory.getLogger(classOf[PullRequestsControllerBase]) @@ -163,6 +164,20 @@ } } + // call web hook + val webHookURLs = getWebHookURLs(owner, name) + if(webHookURLs.nonEmpty){ + val payload = WebHookPayload( + git, + loginAccount, + mergeBaseRefName, + repository, + commits.flatten.toList, + getAccountByUserName(owner).get) + + callWebHook(owner, name, webHookURLs, payload) + } + // notifications Notifier().toNotify(repository, issueId, "merge"){ Notifier.msgStatus(s"${baseUrl}/${owner}/${name}/pull/${issueId}")