Skip to content

Filtering options for issues and pull requests #641

Description

@mislav

This is a tracking ticket listing all the filtering options for issues and pull request currently available on GitHub and the status of their availability in GitHub CLI. (Checked means implemented and merged to master.)

We do not plan to explicitly support all these filtering options in CLI. We will select those that we intend to implement on a case-by-case basis.

Filtering options available through GitHub web UI

Issues

Pull requests

  • assignee --assignee, -a
  • assigned to the current authenticating user
  • no assignee
  • labels --label, -l ("OR" logic)
  • labels --label, -l ("AND" logic) BUG: gh pr list and issue list --label uses OR logic instead of AND logic #419
  • excluding a label
  • no label
  • state --state, -s
  • author --author, -A
  • authored by the current authenticating user
  • mentioning {user|team}
  • mentioning the current authenticating user
  • project
  • no project
  • milestone
  • no milestone
  • review status
    • no reviews
    • review required
    • approved
    • changes requested
    • reviewed by {user|team}
    • reviewed by the current authenticating user
    • not reviewed by {user|team}
    • not reviewed by the current authenticating user
    • awaiting review from {user|team}
    • awaiting review from the current authenticating user

Filtering options available through advanced search syntax

Issues

  • commented on by {user}
  • number of comments
  • number of interactions
  • number of reactions
  • involves {user}
  • linked issue/pull request
  • date created
  • date updated
  • date closed

Pull requests

  • commented on by {user}
  • number of comments
  • number of interactions
  • number of reactions
  • involves {user}
  • linked issue/pull request
  • date created
  • date updated
  • date closed
  • date merged
  • search by commit SHA
  • draft status
  • base branch --base, -B
  • head branch

Activity

  1. eddumelendez commented on Mar 12, 2020

    @eddumelendez
    Contributor

    @mislav for PRs we are blocked due to there is no filterBy. Let us know in this ticket when this is ready in the GitHub GraphQL API please.

  2. sanbornhilland commented on May 13, 2020

    @sanbornhilland

    Installing and getting started with these tools was a breeze but I hit a wall pretty quick because I want to be able to filter issues by Milestone. I'd love to see that filter get added. Let me know if this is the wrong place to express feature requests.

  3. AliabbasMerchant commented on Jul 21, 2020

    @AliabbasMerchant
    Contributor

    @mislav We can tick off filtering issues by 'mention' and 'milestone', thanks to #644

  4. matschaffer commented on Jul 27, 2020

    @matschaffer
    Contributor

    The milestone filter doesn't appear to work in gh version 0.11.0 (2020-07-16)

    For example on https://github.com/Safecast/safecastapi/milestone/4

    I can see the issue by author

    ❯ gh issue list -A seanbonner | grep backup
    89	OPEN	Need How To restore from backup		2019-06-12 03:23:13 +0000 UTC
    

    But not by milestone

     ❯ gh issue list --milestone 'AWS Migration'
    
    No issues match your search in Safecast/safecastapi
    
  5. eddumelendez commented on Jul 28, 2020

    @eddumelendez
    Contributor

    @matschaffer I was looking into it and looks like --milestone works with the milestone_id but it is not the number or id that you can get from the graphql api. I got that id using issuePrioritiesDebug

  6. matschaffer commented on Jul 28, 2020

    @matschaffer
    Contributor
  7. mislav commented on Jul 28, 2020

    @mislav
    ContributorAuthor

    I'm sorry for the inconvenience! I've opened an issue for this.

    @matschaffer Right now you could use gh api:

    $ gh api -XGET repos/safecast/safecastapi/milestones -f state=open | jq -r '.[] | [.id,.title] | @tsv'
    1731740	AWS Migration
    243498	Hackweek Jan 2013
    1326945	2015-10: API hackathon
    3846631	Hackweek2018
  8. pinned this issue on Sep 18, 2020
  9. unpinned this issue on Sep 19, 2020
  10. alexweininger commented on Sep 20, 2020

    @alexweininger

    Would love to see the no milestone filter for issues. Would make triage from cli easier.

  11. pinned this issue on Sep 22, 2020
  12. spywhere commented on Sep 23, 2020

    @spywhere

    Meanwhile, should you guys want to try, I have made my shell command (backed by gh api, jq, awk and sed) to support a search query. Feel free to take a look!

    https://github.com/spywhere/dotfiles/blob/ed7843c77d71e2cd0e7c6696fe4b50ac7591fb50/bin/ghs

    1FB4EAFF-EB96-4FA4-B50E-D1F3CE3B99F3

  13. Croydon commented on Sep 30, 2020

    @Croydon

    It would be also a great filter for issues which either have or do not have linked pull request(s) which can fix the issue

  14. 14 remaining items

  15. g14a commented on Mar 30, 2021

    @g14a
    Contributor

    @mislav I'd like to work on filtering PRs based on review status if its not assigned to anyone already or if there's an open PR which does that?

  16. mislav commented on Mar 30, 2021

    @mislav
    ContributorAuthor

    Everyone: v1.8.0 is now out with support for gh issue/pr list --search parameter which allows you access to any filtering and sorting option for which there is no explicit flag yet. Check out the GitHub search syntax

    @g14a Sure but let's discuss first. Right now filtering based on reviewer status can be done like so:

    gh pr list -S "review:approved"
    

    Are you thinking that this deserves its own cli flag?

  17. g14a commented on Mar 31, 2021

    @g14a
    Contributor

    @mislav Oh alright. I was looking at the check boxes and noticed they weren't ticked off, and thought I could work on them. I totally forgot the search syntax works for PRs as well. Sorry about that. The search flag works absolutely fine. There's no need for a new cli flag.

  18. Soffieswan69 commented on Aug 31, 2021

    @Soffieswan69
  19. Soffieswan69 commented on Aug 31, 2021

    @Soffieswan69
  20. BLasan commented on Oct 2, 2021

    @BLasan

    @mislav Is there anything left?

  21. arthropodSeven commented on Oct 7, 2021

    @arthropodSeven

    Is there any functionality on this list that can't be accomplished via the -S flag?

  22. mislav commented on Dec 14, 2021

    @mislav
    ContributorAuthor

    Closing this as all filtering options are now available through --search and there is no upcoming work to track anymore. We do not intend to add explicit flags for each of the filtering options, so more advanced filtering queries will need to depend on using the GitHub Search syntax on the CLI. For example, to find PRs based on a commit SHA:

    gh pr list -s merged -S <commit-sha>
    

    Currently, the CLI offers no documentation on how to effectively use the --search parameter, but we plan to link to online docs detailing all the available search directives. This is being tracked here: #4887

  23. unpinned this issue on Jan 7, 2022
  24. szalapski commented on Oct 29, 2024

    @szalapski

    So there's no way to filter to PRs with "changes requested" or review approved or "Draft" or "Review required"?

  25. andyfeller commented on Oct 31, 2024

    @andyfeller
    Contributor

    So there's no way to filter to PRs with "changes requested" or review approved or "Draft" or "Review required"?

    @szalapski : I recommend checking out GitHub Docs "Search by pull request review status and reviewer" which describes the review:changes_requested search qualifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreThis issue is not accepting PRs from outside contributorsenhancementa request to improve CLI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions