Search code examples
github-api

Github API: Is it possible to list Pull Requests by label?


I've been looking through the API docs, but I was unable to find a way to accomplish that. Thought I'd ask here in case anyone knows. thanks!


Solution

  • Use the Search Issues API endpoint:

    • Use the repo keyword to filter by repo (e.g. repo:ionicabizau/scrape-it)
    • Use the is:pr to filter the pull requests (note that pull requests are issues, but issues are not pull requests)
    • Use the label keyword to filter by label: label:your-label

    Example:

    https://api.github.com/search/issues?q=is:pr%20label:enhancement%20repo:ionicabizau/scrape-it