GitHub CLI 1.7.0
New features
The repo list command
The gh repo list command lists GitHub repositories under a user or organization account (#2953).
Improvements to the api command
The gh api command is a tool to directly access the GitHub API with in your scripts. This release adds functionality to make it easier to working with the resulting JSON.
The api --jq option takes a query in jq syntax and prints only the result (#3012). This works even if the jq utility isn't present on the system:
$ gh api repos/:owner/:repo --jq '.full_name, .description'
cli/cli
GitHub’s official command line toolFor more complex output formatting, the api --template option renders the output according to the provided Go template (#3011).
template='{{ range .items -}}
{{.full_name | color "blue+h"}} ({{.stargazers_count | color "yellow"}})
{{ end }}'
gh api -X GET search/repositories -f q='cli language:go' -f per_page=10 -t "$template"To make experimenting with output formats quicker and to avoid API rate limits, the api --cache option allows caching the response on disk for a specified amount of time (#3010).
Finally, the api --preview option makes it easier to opt into GitHub API previews (#3077):
$ gh api repos/cli/cli/issues/3012/reactions -p squirrel-girl --jq '.[] | "\(.user.login): \(.content)"'
samcoe: heart
gagliardetto: heart
cristiand391: heart
laughedelic: heart
casperdcl: heartOther new functionality
-
Allow passing
issue/pr createbody from file or standard input #3018 -
Add
pr edit --baseto change the base branch of a PR #3022 -
Allow
pr editwithout the pull request argument #3024 -
Allow
gist viewwithout arguments #3008 -
Add
gist edit -a <file>flag to add files to a gist #2997
Fixes
-
Fix setting up a local repository on
repo create --template#2991 -
Clarify the
repo createinteractive prompt #2991 -
Avoid crash in
pr mergewhen the pull request has no commits #3036 -
Fix git authentication when the token comes from environment #3009
-
Have git authentication be resilient to PATH changes #3075
-
Avoid checking for new releases when authenticating git #3083
-
When gh is installed via Homebrew, avoid showing the upgrade notice until the homebrew formula is updated #3020
-
Validate
gistarguments #3021 -
Have
ghexit with non-zero status when the user cancels a command #3023
Contributors
Thank you:
- Gowtham Munukutla @g14a
- Cristian Dominguez @cristiand391
- Ben @ganboonhong
- @fossdd
- @castaneai
for contributing code that went into this release! And, as always, thank you to everyone who reported or upvoted bugs on our issue tracker and gave feedback in the Discussions section.

