【问题标题】:GitHub REST API for getting repo's all open pull requests COUNT without downloading themGitHub REST API 用于获取 repo 的所有打开的拉取请求 COUNT 而不下载它们
【发布时间】:2019-11-03 16:12:23
【问题描述】:

我正在尝试查找用于开放拉取请求计数的 GitHub API,而无需下载它们。 () 我查看了 GitHub 搜索 API 和 repos API https://developer.github.com/v3/search/#search-issues-and-pull-requests https://api.github.com/repos/pulls?state=open 但是这里没找到。

example of big repository

【问题讨论】:

    标签: rest github


    【解决方案1】:

    要搜索 PR,您可以使用带有 is:pr 修饰符的问题搜索:

    https://api.github.com/search/issues?q=rockstars%20state:open%20is:pr

    响应的total_count 字段是您所需要的。

    【讨论】:

    • 还有一个问题。我也在寻找搜索 API 提交部分。 (获取给定存储库的所有提交计数)help.github.com/en/github/searching-for-information-on-github/… 他们提出了一个搜索查询,但是当我尝试在查询 repo:USERNAME/REPO 中使用我的给定用户名和存储库时,我遇到了一个验证问题。
    • 看起来这是因为您不能使用搜索来获取所有提交。您应该提供一个搜索字符串(在 repo 和用户名旁边)。因此,例如这将不起作用:api.github.com/search/commits?q=repo:1int/rockstars,但在向其添加“测试”搜索字符串时它可以正常工作:api.github.com/search/commits?q=repo:1int/rockstars+test
    • 我收到一条消息 - 您必须在“接受”标头中指定自定义媒体类型。有关完整详细信息,请参阅文档。",
    • 哦,我以为你是这样做的。是的,您需要在 HTTP 请求中指定标头。标头名称为“Accept”,值应为“application/vnd.github.cloak-preview”。根据您的工具集,它会有所不同。例如,在 PHP 中你会写: header("Accept", "application/vnd.github.cloak-preview").
    猜你喜欢
    • 1970-01-01
    • 2020-01-09
    • 1970-01-01
    • 2012-09-22
    • 1970-01-01
    • 2021-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多