Search in sources :

Example 1 with GithubPr

use of com.google.startupos.tools.reviewer.local_server.service.Protos.GithubPr in project startup-os by google.

the class DiffConverter method toPullRequests.

public ImmutableList<PullRequest> toPullRequests(Diff diff, ImmutableMap<String, GitRepo> repoNameToGitRepos) {
    ImmutableList.Builder<PullRequest> pullRequests = ImmutableList.builder();
    for (GithubPr githubPr : diff.getGithubPrList()) {
        PullRequest.Builder pullRequest = PullRequest.newBuilder();
        if (githubPr.getNumber() != 0) {
            pullRequest.setNumber(githubPr.getNumber());
        }
        pullRequest.setState(getPullRequestState(diff.getStatus())).setTitle("D" + diff.getId()).setUser(User.newBuilder().setEmail(diff.getAuthor().getEmail()).build()).setBody(diff.getDescription()).setCreatedAt(Instant.ofEpochMilli(diff.getCreatedTimestamp()).toString()).setUpdatedAt(Instant.ofEpochMilli(diff.getModifiedTimestamp()).toString()).setBaseBranchName("master").setHeadBranchName("D" + diff.getId()).setRepo(githubPr.getRepo()).addAllReviewComment(getReviewCommentsByRepoName(diff.getCodeThreadList(), githubPr.getRepo(), repoNameToGitRepos, diff.getModifiedTimestamp(), diff.getId())).addAllIssueComment(getIssueComments(diff.getDiffThreadList(), githubPr.getRepo())).setOwner(githubPr.getOwner()).setAssociatedReviewerDiff(diff.getId());
        pullRequests.add(pullRequest.build());
    }
    return pullRequests.build();
}
Also used : GithubPr(com.google.startupos.tools.reviewer.local_server.service.Protos.GithubPr) ImmutableList(com.google.common.collect.ImmutableList) PullRequest(com.google.startupos.tools.reviewer.job.sync.GithubPullRequestProtos.PullRequest)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 PullRequest (com.google.startupos.tools.reviewer.job.sync.GithubPullRequestProtos.PullRequest)1 GithubPr (com.google.startupos.tools.reviewer.local_server.service.Protos.GithubPr)1