1

I’m using the Github CLI tool, which includes a command gh pr list that allows you to see all the open pull requests.

The issue is that I only see a list of their titles and there’s a separate command gh pr view [extra info] that actually allows you to see the body.

I’m searching for pull requests that have a certain phrase in the BODY so gh pr list | grep “hello” wouldn’t work because it only gives me pull requests with “hello” in the header, and not necessarily the body.

How might I go about approaching this problem and are there any shortcuts in the github cli that might help me?

torek
  • 448,244
  • 59
  • 642
  • 775
  • Here is the manual [man: gh pr view](https://cli.github.com/manual/gh_pr_view). Did you explore the arguments to the `list` sub-command? Probably something like: `gh pr view --json number,title,body,reviews,assignees` ... You can use even with `--template` ( [more](https://cli.github.com/manual/gh_help_formatting) ) – azbarcea Apr 18 '22 at 22:25

1 Answers1

0

Sicne gh pr list, like gh pr view, does inherit from the same option --json <fields> (Output JSON with the specified fields), you can use:

gh pr list --json number,body | grep "helllo"

That would grep for your specific message, and still give you an ID that you can use with gh pr view.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250