gh-search-prs1
Search for pull requests
Usage
gh search
prs
[<query>]
[flags]
Overview
Search for pull requests on GitHub.
The command supports constructing queries using the GitHub search syntax, using the parameter and qualifier flags, or a combination of the two.
GitHub search syntax is documented at:
⟨https://docs.github.com/search-github/searching-on-github/searching-issues-and-pull-requests⟩
On supported GitHub hosts, advanced issue search syntax can be used in the --search query. Advanced search syntax, like boolean operators OR/AND, and parentheses for nesting, must be passed as separate arguments, rather than within a quoted multi-word string. This syntax is not supported with --web. For more information about advanced issue search, see:
⟨https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/filtering-and-searching-issues-and-pull-requests#building-advanced-filters-for-issues⟩
For more information on handling search queries containing a hyphen, run gh search --help.
Options
-
--app <string> -
Filter by GitHub App author
-
--archived -
Filter based on the repository archived state {true|false}
-
--assignee <string> -
Filter by assignee
-
--author <string> -
Filter by author (use --app to filter by a GitHub App)
-
-B, --base <string> -
Filter on base branch name
-
--checks <string> -
Filter based on status of the checks: {pending|success|failure}
-
--closed <date> -
Filter on closed at date
-
--commenter <user> -
Filter based on comments by user
-
--comments <number> -
Filter on number of comments
-
--created <date> -
Filter based on created at date
-
--draft -
Filter based on draft state
-
-H, --head <string> -
Filter on head branch name
-
--interactions <number> -
Filter on number of reactions and comments
-
--involves <user> -
Filter based on involvement of user
-
-q, --jq <expression> -
Filter JSON output using a jq expression
-
--json <fields> -
Output JSON with the specified fields
-
--label <strings> -
Filter on label
-
--language <string> -
Filter based on the coding language
-L,--limit<int> (default 30)-
Maximum number of results to fetch
-
--locked -
Filter on locked conversation status
-
--match <strings> -
Restrict search to specific field of issue: {title|body|comments}
-
--mentions <user> -
Filter based on user mentions
-
--merged -
Filter based on merged state
-
--merged-at <date> -
Filter on merged at date
-
--milestone <title> -
Filter by milestone title
-
--no-assignee -
Filter on missing assignee
-
--no-label -
Filter on missing label
-
--no-milestone -
Filter on missing milestone
-
--no-project -
Filter on missing project
--order<string> (default "desc")-
Order of results returned, ignored unless '--sort' flag is specified: {asc|desc}
-
--owner <strings> -
Filter on repository owner
-
--project <owner/number> -
Filter on project board owner/number
-
--reactions <number> -
Filter on number of reactions
-
-R, --repo <OWNER/REPO> -
Filter on repository, in OWNER/REPO format
-
--review <string> -
Filter based on review status: {none|required|approved|changes_requested}
-
--review-requested <user> -
Filter on user or team requested to review
-
--reviewed-by <user> -
Filter on user who reviewed
--sort<string> (default "best-match")-
Sort fetched results: {comments|reactions|reactions-+1|reactions--1|reactions-smile|reactions-thinking_face|reactions-heart|reactions-tada|interactions|created|updated}
-
--state <string> -
Filter based on state: {open|closed}
-
--team-mentions <string> -
Filter based on team mentions
-
-t, --template <string> -
Format JSON output using a Go template; see "gh help formatting"
-
--updated <date> -
Filter on last updated at date
-
--visibility <strings> -
Filter based on repository visibility: {public|private|internal}
-
-w, --web -
Open the search query in the web browser
Json fields
assignees, author, authorAssociation, body, closedAt, commentsCount, createdAt, id, isDraft, isLocked, isPullRequest, labels, number, repository, state, title, updatedAt, url
Exit status
0: Successful execution
1: Error
2: Command canceled
4: Authentication required
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.
Examples
# Search pull requests matching set of keywords "fix" and "bug" $ gh search prs fix bug # Search draft pull requests in cli repository $ gh search prs --repo=cli/cli --draft # Search pull requests using raw search qualifiers as separate arguments $ gh search prs is:merged author:monalisa # Search open pull requests requesting your review $ gh search prs --review-requested=@me --state=open # Search merged pull requests assigned to yourself $ gh search prs --assignee=@me --merged # Search pull requests with numerous reactions $ gh search prs --reactions=">100" # Search pull requests without label "bug" $ gh search prs -- -label:bug # Search pull requests only from un-archived repositories (default is all repositories) $ gh search prs --owner github --archived=false
Releases
3 releases since Debian 12 (Bookworm); the text changed 2 times.
-R since Debian 13 (Trixie).
--limit until Debian 12 (Bookworm);
--order until Debian 12 (Bookworm);
--sort until Debian 12 (Bookworm);
-L until Debian 12 (Bookworm).