How can I search only for issues in github repository through github rest api?

Viewed 1434

I want to get only issues and not pull requests from GitHub rest api in a specific repository, but https://api.github.com/repos/user/repo/issues endpoint returns both issues and pull requests. Github rest api docs don't say anything about searching in a specific repository. Adding q parameter to the above method does not do anything. I can't filter response to find only issues because my repository contains much more pull requests than issues. What is the way to get only issues?

2 Answers

The more compact option would be (March 2022) to use gh 2.7.0, and it new command gh search issues

Adds the search issues and search prs command.

The search issues command includes a --include-prs flag that allows for including pull requests in the search results.

https://user-images.githubusercontent.com/7969779/159436553-7ff52845-7c89-42f6-9b5b-588d7c44e4e9.png -- Screen Shot 2022-03-22 at 10 13 15 AM

Related