Skip to content

GitHub CLI 1.7.0

Choose a tag to compare

@github-actions github-actions released this 04 Mar 18:14
· 7644 commits to trunk since this release
6b483aa

New features

The repo list command

The gh repo list command lists GitHub repositories under a user or organization account (#2953).

Screen Shot 2021-03-04 at 18 13 36

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 tool

For 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"

Screen Shot 2021-03-04 at 19 00 54

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: heart

Other new functionality

  • Allow passing issue/pr create body from file or standard input #3018

  • Add pr edit --base to change the base branch of a PR #3022

  • Allow pr edit without the pull request argument #3024

  • Allow gist view without 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 create interactive prompt #2991

  • Avoid crash in pr merge when 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 gist arguments #3021

  • Have gh exit with non-zero status when the user cancels a command #3023

Contributors

Thank you:

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.