Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find number of closed issues for a repository?

Tags:

github-api

You can find the number of open issues for a project via the Repositories > Get method in GitHub's API.

But is there any way to find the number of closed issues or the total number of issues, without iterating over all issues? Such information is available on the issues page of each project, but it doesn't seem to be present in the API.

For example, on https://github.com/nodejs/node/issues:

Issue count for Node repository

like image 554
Fedir RYKHTIK Avatar asked Sep 15 '25 09:09

Fedir RYKHTIK


1 Answers

Per this issue comment, you can use the search API, rather than the issues API, to get an issue count. The relevant API docs cover the use of a state filter in the search term.

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

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

As noted in the comments, as you only care about the count of the issues you can add per_page=1 to the query parameters to minimise the data fetched, which might speed things up a bit.

like image 150
jonrsharpe Avatar answered Sep 18 '25 08:09

jonrsharpe