使用github-java sdk添加审阅者以拉取请求

时间:2019-08-26 06:09:14

标签: java github-api

我正在尝试使用https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core创建请求请求,但找不到找到对请求请求添加评论的方法。 V3 Github API支持添加审核者,如此处https://developer.github.com/v3/pulls/review_requests/#create-a-review-request所述。我正在尝试如下创建拉取请求。

private void createPullRequest(
        String repositoryName,
        String repositoryOwner,
        String pullRequestTitle,
        String pullRequestBody,
        String branchSource,
        String branchDestination
) throws IOException {

    logger.info("starting to create pull request");

    var gitHubClient = new GitHubClient();
    gitHubClient.setCredentials("x", "y");
    var repositoryService = new RepositoryService(gitHubClient);
    var repository = repositoryService.getRepository(repositoryOwner, repositoryName);

    var pullRequestService = new PullRequestService(gitHubClient);
    var pullRequest = new PullRequest();
    pullRequest.setTitle(pullRequestTitle);
    pullRequest.setBody(pullRequestBody);

    pullRequest.setHead(
            new PullRequestMarker().setRef(branchSource).setLabel(branchSource)
    );

    pullRequest.setBase(
            new PullRequestMarker().setRef(branchDestination).setLabel(branchDestination)
    );

    logger.info("Finally starting to push PR");

    pullRequestService.createPullRequest(repository, pullRequest);

    logger.info("PR should be created now");
}

它说的文档支持100%的Github V3 API。但是我无法在代码和在线中找到任何添加评论者的参考。

谢谢!

0 个答案:

没有答案