githubgithub-apigithub-api-v3

Search a github organization for repositories with a known PR name pattern


One of our application can submit a github PR based on user request. User can decide to merge this PR or keep them unmerged.

Is there a way to search a git hub organization to find repositories with an unmerged PR. PR follows a naming pattern ie a static string with a dynamic part at the end.

ie. search git-org for all repos with a PR name like %auto_generated_pr_name_pattern%

Thanks, San


Solution

  • You can try a GitHub search, which does include operators for merged or unmerged PR:

    is:unmerged
    

    Example: error is:unmerged matches closed issues and pull requests with the word "error".

    You can add an in:title operator to search for PR names.

    On The GitHub API side, you have Search Issues, which, as its names does not suggest, allows to search PR as well.
    Its search parameters include:

    is: Searches for items within repositories that match a certain state, such as open, closed, or merged.

    As Samuel Neff points out in the comments:

    OP also asked for within a specific organization, which you can add to search conditions with org:myorganization.