diff options
Diffstat (limited to 'src/main/scala/com/getbootstrap/rorschach/server/PullRequestEventHandler.scala')
-rw-r--r-- | src/main/scala/com/getbootstrap/rorschach/server/PullRequestEventHandler.scala | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/scala/com/getbootstrap/rorschach/server/PullRequestEventHandler.scala b/src/main/scala/com/getbootstrap/rorschach/server/PullRequestEventHandler.scala index 055fb5c..686937c 100644 --- a/src/main/scala/com/getbootstrap/rorschach/server/PullRequestEventHandler.scala +++ b/src/main/scala/com/getbootstrap/rorschach/server/PullRequestEventHandler.scala @@ -5,25 +5,25 @@ import com.getbootstrap.rorschach.auditing.{BaseAndHeadBranchesAuditor, Modified import scala.collection.JavaConverters._ import scala.util.{Try,Success,Failure} import akka.actor.ActorRef -import org.eclipse.egit.github.core._ -import org.eclipse.egit.github.core.service.{CommitService, OrganizationService} +import com.jcabi.github.User +import com.jcabi.github.Coordinates.{Simple=>RepoId} +import com.jcabi.github.Pull.{Smart=>PullRequest} import com.getbootstrap.rorschach.github._ -import com.getbootstrap.rorschach.github.util._ +import com.getbootstrap.rorschach.github.implicits._ class PullRequestEventHandler(commenter: ActorRef) extends GitHubActorWithLogging { - private def modifiedFilesFor(repoId: RepositoryId, base: CommitSha, head: CommitSha) = { - val commitService = new CommitService(gitHubClient) - Try { commitService.compare(repoId, base.sha, head.sha) }.map { comparison => - val affectedFiles = comparison.getFiles.asScala + private def modifiedFilesFor(repoId: RepoId, base: CommitSha, head: CommitSha) = { + Try { gitHubClient.repos.get(repoId).commits.compare(base.sha, head.sha) }.map{ comparison => + val affectedFiles = comparison.smart.files.asScala affectedFiles.filter{ _.status == Modified }.map{ _.getFilename }.toSet[String] } } def isTrusted(user: User): Boolean = { - val orgService = new OrganizationService(gitHubClient) settings.TrustedOrganizations.exists{ org => Try{ orgService.isPublicMember(org, user.getLogin) }.toOption.getOrElse(false) } } + // FIXME: caller needs to pass SmartPull override def receive = { case pr: PullRequest => { val bsBase = pr.getBase @@ -52,7 +52,7 @@ class PullRequestEventHandler(commenter: ActorRef) extends GitHubActorWithLoggin val allMessages = fileMessages ++ branchMessages if (allMessages.nonEmpty) { - commenter ! PullRequestFeedback(destinationRepo, pr.number, pr.getUser, allMessages) + commenter ! PullRequestFeedback(destinationRepo, pr.number, pr., allMessages) } else { log.info(s"Repo ${destinationRepo} ${pr.number} successfully passed all audits.") |