gh pr view *

built-in
6.2% Savings
7 Commands
167 Tokens saved
2 Tests

Install

tokf install a8b89982fdae089f4ee3df552ad01bdb9bac1d103552b0a7d2892aaf931599eb
Safety checks passed

Filter definition

command = "gh pr view *"
run = "gh pr view {args} --json number,title,state,author,headRefName,baseRefName,reviewDecision,labels,assignees,milestone,body"

[json]

[[json.extract]]
path = "$.number"
as = "number"

[[json.extract]]
path = "$.title"
as = "title"

[[json.extract]]
path = "$.state"
as = "state"

[[json.extract]]
path = "$.author.login"
as = "author"

[[json.extract]]
path = "$.headRefName"
as = "head"

[[json.extract]]
path = "$.baseRefName"
as = "base"

[[json.extract]]
path = "$.reviewDecision"
as = "review"

[[json.extract]]
path = "$.milestone"
as = "milestone"

[[json.extract]]
path = "$.body"
as = "body"

[[json.extract]]
path = "$.labels[*]"
as = "labels"

[[json.extract.fields]]
field = "name"
as = "name"

[[json.extract]]
path = "$.assignees[*]"
as = "assignees"

[[json.extract.fields]]
field = "login"
as = "login"

[on_success]
output = "#{number} {title}\nstate: {state}\nauthor: {author}\nbranch: {head} -> {base}\nreview: {review}\nassignees: {assignees | each: \"{login}\" | join: \", \"}\nlabels: {labels | each: \"{name}\" | join: \", \"}\nmilestone: {milestone}\n--\n{body}"

[on_failure]
tail = 10

Examples

auth error shows tail ~39 tokens → ~39 tokens
Raw output
To get started with GitHub CLI, please run:  gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.
Filtered output
To get started with GitHub CLI, please run:  gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.
PR view extracts JSON fields ~71 tokens → ~48 tokens (32% saved)
Raw output
{"assignees":[],"author":{"login":"scarf005"},"baseRefName":"trunk","body":"Summary of changes...","headRefName":"fix/repo-fork","labels":[{"name":"external"}],"milestone":null,"number":12813,"reviewDecision":"REVIEW_REQUIRED","state":"OPEN","title":"fix(repo fork): set default repo"}
Filtered output
#12813 fix(repo fork): set default repo
state: OPEN
author: scarf005
branch: fix/repo-fork -> trunk
review: REVIEW_REQUIRED
assignees: 
labels: external
milestone: null
--
Summary of changes...
Warning: Community filters are third-party code. Review the filter definition above before installing it in production environments.
Browse all filters