Repository navigation
Filtering options for issues and pull requests #641
Description
Activity
@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.Reacted by Mislav Marohnić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.
Reacted by Alexander KainThe 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 UTCBut not by milestone
❯ gh issue list --milestone 'AWS Migration' No issues match your search in Safecast/safecastapi@matschaffer I was looking into it and looks like
--milestoneworks with themilestone_idbut it is not thenumberoridthat you can get from the graphql api. I got that id usingissuePrioritiesDebug- Is there a way to pull that from the cli?On Tue, Jul 28, 2020 at 10:13 Eddú Meléndez Gonzales < ***@***.***> wrote: @matschaffer <https://github.com/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 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#641 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAAFMQMIBFG6KIZQCM3N33R5YQZ7ANCNFSM4LGSGMQA> .--…-Mat matschaffer.com
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
- pinned this issue
on Sep 18, 2020 - unpinned this issue
on Sep 19, 2020 Would love to see the no milestone filter for issues. Would make triage from cli easier.
Reacted by Mislav Marohnić, Mats Wichmann and Andriy Svyryd- pinned this issue
on Sep 22, 2020 Meanwhile, should you guys want to try, I have made my shell command (backed by
gh api,jq,awkandsed) to support a search query. Feel free to take a look!https://github.com/spywhere/dotfiles/blob/ed7843c77d71e2cd0e7c6696fe4b50ac7591fb50/bin/ghs
Reacted by Shaun Becker, Mislav Marohnić, Ben Gubler and Garry TrinderIt would be also a great filter for issues which either have or do not have linked pull request(s) which can fix the issue
Reacted by Aliabbas Merchant and Near Huscarl14 remaining items
@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?
Reacted by Carlo CabreraEveryone: v1.8.0 is now out with support for
gh issue/pr list --searchparameter 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?
Reacted by Sirisak Lueangsaksri, Gowtham Munukutla, Dani Comnea, Umut Seven, pavol kutaj and number5@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.
Reacted by Mislav Marohnić@mislav Is there anything left?
Is there any functionality on this list that can't be accomplished via the
-Sflag?Closing this as all filtering options are now available through
--searchand 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
--searchparameter, but we plan to link to online docs detailing all the available search directives. This is being tracked here: #4887Reacted by sideshowbarker- unpinned this issue
on Jan 7, 2022 So there's no way to filter to PRs with "changes requested" or review approved or "Draft" or "Review required"?
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_requestedsearch qualifier.

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
--assignee, -alabels--label, -l("OR" logic)--label, -l("AND" logic) BUG: gh pr list and issue list --label uses OR logic instead of AND logic #419--state, -s--author, -AAdd filter issues by author #625Pull requests
--assignee, -alabels--label, -l("OR" logic)--label, -l("AND" logic) BUG: gh pr list and issue list --label uses OR logic instead of AND logic #419--state, -s--author, -AFiltering options available through advanced search syntax
Issues
Pull requests
--base, -B