gitgithubcommand-line

Github issue search in command line


I am trying to search for issues with keywords in github.
I want to achieve this from command line.

I have already tried ghi (stephencelis/ghi: GitHub Issues on the command line) --> the installation doesn't work.
Could you please suggest any other options?


Solution

  • 2022: gh 2.7.0 comes with 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

    2024: gh v2.55.0 proposes in cli/cli PR 9453:

    • Update gh search prs --project flag doc to specify owner/number syntax
    • Update gh search issues --project flag doc to specify owner/number syntax

    https://private-user-images.githubusercontent.com/5891697/357212349-513c7ca3-4b64-4267-bf08-8204a262c919.png

    https://private-user-images.githubusercontent.com/5891697/357212462-102365da-59a2-4357-8467-3bfc1463d829.png


    Update 2020: The GitHub CLI gh is now 1.0 and available.
    As noted in Alireza's answer, it can list issue through the gh issue list command.

    If the keyword is a label, you can use gh issue list -l xxx to filter by label.
    If not, grepping the title is a possible workaround.

    From GH 1.8.0

    The new issue/pr list --search flag enables searching issues and pull requests using keywords.

    In addition to searching by words that may appear in the contents of issues or pull requests, you can use any GitHub search syntax for more specific matching and to change the order of the results.

    For example:

    • gh issue list --state closed --search "crash in:title" - closed issues that contain "crash" in their title
    • gh issue list --search "no:assignee" - open issues without an assignee
    • gh issue list -l "bug" --search "sort:interactions-desc" - bug threads that have the most interactions
    • gh pr list --search "review-requested:@me" - pull requests where your review was requested
    • gh pr list --state merged --search "merged:>=2021-03-30" - pull requests merged after a certain date

    2017: You can search issues with GitHub Search APOI using the command-line curl (see this tutorial)

    curl -i -H 'Authorization: token my_token' 'https://api.github.com/search/issues?q=akeyword+repo:auser/arepo'
    

    This is a workaround, while you can debug why a ruby/rail program like stephencelis/ghi does not work.