Count open pull requests and issues on GitHub -
i count open pull requests , issues in repository of github api. found out api endpoint /repos/:owner/:repo
result contains open_issues
property. sum of amount of issues , pull requests.
is there way or calculate amount of open issue , pull requersts in repository?
osowskit correct, easiest way iterate on list of issues , list of pull requests in repository (i'm assuming separate counts each, reading between lines of question).
the issues api return both issues , pull requests, need count both , subtract number of pull requests number of issues count of issues aren't pull requests. example, using wonderful github3.py
python library:
import github3 gh = github3.login(token='your_api_token') issues_count = len(list(gh.repository('owner', 'repo').issues())) pulls_count = len(list(gh.repository('owner', 'repo').pull_requests())) print('{} issues, {} pull requests'.format(issues_count - pulls_count, pulls_count))
Comments
Post a Comment