简体   繁体   中英

github api get number of pull requests

through the GitHub API, is it possible to get the number of open pull requests for a repository without downloading all the extra data related to the pull requests themselves?

For example, when you get the list of your repositories, for each of the repo you can see the number of open issues. Is there a similar property for open pull requests?

You might also take a look at the search api https://developer.github.com/v3/search/#search-issues . Looks like you can filter on type and probably also on closed or not :)

As suggested by codea in the comments:

https://api.github.com/search/issues?q=+type:pr+user:StackExchange&sort=created&order=asc 

I've used the Pulls Request API in combination with jq ability to count objects (see How to count items in JSON object using command line? )

With cURL:

curl https://api.github.com/repos/OWNER/REPO/pulls | jq length

With Github CLI

gh api \
  -H "Accept: application/vnd.github+json" \
  /repos/OWNER/REPO/pulls | jq length

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM