Repository navigation
Filtering options for issues and pull requests #641
Copy link
Copy link
Closed
Labels
coreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributorsenhancementa request to improve CLIa request to improve CLI
Description
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
--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, -AAdd filter issues by author #625 - authored by the current authenticating user
- mentioning user
- mentioning the the current authenticating user
- mentioning team
- project
- no project
- milestone
- no milestone
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributorsenhancementa request to improve CLIa request to improve CLI
Activity
eddumelendez commentedon Mar 12, 2020
@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.sanbornhilland commentedon May 13, 2020
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.
AliabbasMerchant commentedon Jul 21, 2020
@mislav We can tick off filtering issues by 'mention' and 'milestone', thanks to #644
matschaffer commentedon Jul 27, 2020
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
But not by milestone
eddumelendez commentedon Jul 28, 2020
@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 usingissuePrioritiesDebugmatschaffer commentedon Jul 28, 2020
mislav commentedon Jul 28, 2020
I'm sorry for the inconvenience! I've opened an issue for this.
@matschaffer Right now you could use
gh api:alexweininger commentedon Sep 20, 2020
Would love to see the no milestone filter for issues. Would make triage from cli easier.
spywhere commentedon Sep 23, 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
Croydon commentedon Sep 30, 2020
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 remaining items
g14a commentedon Mar 30, 2021
@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?
mislav commentedon Mar 30, 2021
Everyone: 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:
Are you thinking that this deserves its own cli flag?
g14a commentedon Mar 31, 2021
@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.
Soffieswan69 commentedon Aug 31, 2021
Soffieswan69 commentedon Aug 31, 2021
BLasan commentedon Oct 2, 2021
@mislav Is there anything left?
arthropodSeven commentedon Oct 7, 2021
Is there any functionality on this list that can't be accomplished via the
-Sflag?mislav commentedon Dec 14, 2021
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: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: #4887szalapski commentedon Oct 29, 2024
So there's no way to filter to PRs with "changes requested" or review approved or "Draft" or "Review required"?
andyfeller commentedon Oct 31, 2024
@szalapski : I recommend checking out GitHub Docs "Search by pull request review status and reviewer" which describes the
review:changes_requestedsearch qualifier.