github cli/cli v0.10.0

latest releases: v2.49.0, v2.48.0, v2.47.0...
3 years ago

gh api

gh now provides direct access to both the GitHub GraphQL and REST APIs. :owner and :repo can
be used as placeholders for the owner/repo you are running gh in.

$ gh api repos/:owner/:repo/releases

$ gh api graphql -F owner=':owner' -F name=':repo' -f query='
      query($name: String!, $owner: String!) {
              repository(owner: $owner, name: $name) {
                      releases(last: 3) {
                              nodes { tagName }
                      }
              }
      }
'

(#1165, #909, #1093, #1115, #1148, #1114, #1150)

gh alias

If you want to type fewer characters when using gh, the new gh alias command allows you to set
up shortcuts. You can use sequential placeholders like $1 and $2 to insert arguments into alias
expansions.

For example, running gh alias set co 'pr checkout' now lets you run gh co instead of gh pr checkout.

Much like chocolate and red wine, this new feature pairs well with gh api:

$ gh alias set heart 'api -H Accept:application/vnd.github.squirrel-girl-preview+json repos/:owner/:repo/issues/$1/reactions --raw-field content=heart'

$ gh heart 123 

In the above example, we've created the alias heart that takes one argument, an issue ID. It will
emoji react a heart onto the provided issue <3

Future alias support will allow shelling out to non-gh commands.

(#970, #991, #1103)

Respect GITHUB_TOKEN environment variable

You can now instruct gh to use a specific authentication token by setting the GITHUB_TOKEN environment variable. This enables using gh in non-interactive contexts such as CI jobs.

You may generate Personal Access Tokens here. It's recommended that the token has at least repo and read:org scopes.

(#976)

Split config

gh's configuration is now split into two files: config.yml and hosts.yml. Authentication
information goes in hosts.yml, so users are now free to add config.yml to their dotfiles
repositories.

This change means that gh will be migrating your config to the new format on first write; if you
want to get the new format you can either delete config.yml and re-authenticate or
run a gh config set command to trigger a write of the config.

(#1077)

Refreshed help docs

Our help docs got a spring cleaning both on the command line and in the manual. The output of gh help should be more legible and useful now.

(#1106, #1167, #1166, #998, #1059, #1126)

gist support

gh gist create is now supported. You can pass it a filename for posting or pipe something via STDIN. This actually shipped a little while ago but we didn't announce it. Now you know!

Polish

  • Forward issue metadata via query parameters in gh issue/pr create --web mode #992
  • gh repo clone myrepo now assumes the authenticated user as default owner #861
  • Allow choosing "blank" template in gh issue/pr create #950
  • Validate the value of the gh issue/pr list --limit flag #1157
  • Initialize user's config file with commented-out examples #1158

Bugfixes

  • Fix referring to loopback interface in OAuth flow #1014
  • Fix showing "Authentication complete" notice after OAuth dance #1013
  • Fix error while adding Milestone Metadata to PR during create #1124

Development

  • Add docs about new triage rotation #1129
  • Consistent PR lookup interface #1020
  • Align color func declarations with go style #1143
  • Bump project dependencies #1036
  • Do not yet try and use gh from makefile bc of CI #999
  • Update release doc content #1001
  • Rename "master" to "trunk" in various links #1002
  • Upgrade to Cobra 1.0 #916
  • Update setup-go version #1140
  • Use new httpmock API in repo_test.go #1122
  • Redundant type slice-string #1160
  • Remove duplicated words in PULL_REQUEST_TEMPLATE #1163

As always, THANK YOU! to our numerous community contributers <3

all the best,
vilmibm and the whole CLI team

Don't miss a new cli release

NewReleases is sending notifications on new releases.