是否可以 clone/download 通过 Github API 安装在原始存储库中的 Pull Request 的分支私有存储库?

Is it possible to clone/download a forked private repository of a Pull Request in by Github API installed in Original Repository?

我创建了一个 GitHub 应用程序并将其安装到私有存储库。
它检测 Pull Requests 并自动添加评论,运行 对传入的 PR 进行一些测试。

当 PR 来自同一个存储库时,它工作正常,
但是当 PR 来自另一个私有分支存储库时它不起作用。 (我认为是由于权限问题)

下面的示例代码是我如何克隆代码(压缩文件)GitHub:

String template = "https://api.github.com/repos/%s/%s/zipball/refs/heads/%s";
String path = String.format(template, "USER", "REPOSITORY", "BRANCH");

HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create(path))
        .header("Authorization", "Bearer " + TOKEN)
        .header("Accept", "application/vnd.github.v3+json")
        .build();

// returns a redirect link to download the zipped code
HttpResponse<String> response = HttpClient.newHttpClient()
        .send(request, BodyHandlers.ofString());

不幸的是,你的头上没有任何烫发(分叉)回购。

由于 PR 本身属于基础 repo,尽管你对 pull 有权限 API,所以你可以使用 this endpoint 和媒体类型来获得 PR 的 diff 或补丁header