如何查找存储库的已关闭问题数?

How to find number of closed issues for a repository?

您可以通过 GitHub 的 API 中的 Repositories > Get 方法查找项目的未解决问题数。

但是有没有什么方法可以在不遍历所有问题的情况下找到已关闭问题的数量或问题总数?每个项目的问题页面上都有此类信息,但 API.

中似乎没有。

例如,在 https://github.com/nodejs/node/issues 上:

issues 附加到您的 URL 它应该 return 所有问题,然后您可以计算对象的数量并推断出哪些是打开的,哪些不是。

调用示例:

https://api.github.com/repos/anandkgpt03/test/issues

每个 this issue comment, you can use the search API, rather than the issues API, to get an issue count. The relevant API docs 涵盖搜索词中状态过滤器的使用。

GET https://api.github.com/search/issues?q=repo:nodejs/node+type:issue+state:closed

{
    "total_count": 6595,
    "incomplete_results": false,
    "items": [...]
}

如前所述 ,因为您只关心 count 个问题,您可以将 per_page=1 添加到查询参数以最小化获取的数据,这可能会加快速度。