Commit graph

114 commits

Author SHA1 Message Date
vilmibm
509be34af6 Merge remote-tracking branch 'origin/master' into wingkwong/master 2020-05-20 17:08:31 -05:00
Mislav Marohnić
4d11732a47
Merge pull request #943 from cli/reauth-bug
pass apiClient to determineBaseRepo
2020-05-18 13:16:07 +02:00
Kevin Bluer
d440a95aed
Improved error message when "owner/repo" format not provided (#919)
Fixes #882
2020-05-18 11:13:48 +02:00
vilmibm
780875d645 fix tests 2020-05-15 16:47:11 -05:00
vilmibm
96ba1eacef undo initial thing 2020-05-15 16:44:51 -05:00
vilmibm
bf05975ceb Revert "small repo fix"
This reverts commit 08e9cdaee1.
2020-05-15 16:40:47 -05:00
vilmibm
7decae71fc untested first pass on ensureScopes 2020-05-15 16:40:13 -05:00
vilmibm
c8c807b954 pass apiClient to determineBaseRepo
Our code had an unspoken assumption that only one apiClient is created
during the course of a command. Violating this assumption is fine in
almost all cases, but not when we need to do a re-auth to add a new
oauth scope to a user's token.

There is likely a more elegant solution to the problem but until then
this changes determineBaseRepo to use an existing apiClient.
2020-05-15 15:29:33 -05:00
vilmibm
08e9cdaee1 small repo fix 2020-05-15 10:25:40 -05:00
vilmibm
3b62d79e81 notes 2020-05-15 09:52:06 -05:00
vilmibm
a62f2987c0 stray debug 2020-05-13 14:59:14 -05:00
vilmibm
cc1ffb0aea pass apiClient to determineBaseRepo
Our code had an unspoken assumption that only one apiClient is created
during the course of a command. Violating this assumption is fine in
almost all cases, but not when we need to do a re-auth to add a new
oauth scope to a user's token.

There is likely a more elegant solution to the problem but until then
this changes determineBaseRepo to use an existing apiClient.
2020-05-13 14:55:49 -05:00
vilmibm
3a7f56456e tweak reauth code and request a new scope 2020-05-13 14:24:29 -05:00
vilmibm
ed1a3a60fd Merge remote-tracking branch 'origin/master' into wingkwong/master 2020-05-13 13:43:09 -05:00
vilmibm
c8e9768bf5 slopwip on interactive review 2020-05-11 15:28:12 -05:00
vilmibm
1675a677d6 hide credits from main help 2020-05-11 12:04:24 -05:00
Mislav Marohnić
1f0db96f2a Avoid relying on Cobra help internals 2020-05-11 12:38:22 +02:00
Corey Johnson
70223d1e32 Don't always use the root command help
Co-Authored-By: Nate Smith <vilmibm@neongrid.space>
2020-05-08 09:19:19 -07:00
Nate Smith
d908320050
Merge pull request #786 from cli/oauth-read-org
Ask for `read:org` OAuth scope, warn for outdated tokens
2020-04-28 20:23:44 -05:00
Nate Smith
fb7b5446d1
Update command/root.go
Co-Authored-By: Corey Johnson <probablycorey@gmail.com>
2020-04-28 20:19:52 -05:00
Nate Smith
ef5932f6cb
Merge pull request #821 from cli/basic-client-auth
Fix gh updater mechanism for unauthenticated users
2020-04-28 20:15:17 -05:00
Corey Johnson
3d2ee3c9b2 fix whitespace 2020-04-27 10:07:47 -07:00
Mislav Marohnić
3aaa231cc5 Guide user through re-authorization flow if read:org scope is missing
How this works for people with existing OAuth tokens:

    $ gh issue list -L1
    Notice: additional authorization required
    Press Enter to open github.com in your browser...
    [auth flow in the browser...]
    Authentication complete. Press Enter to continue...

    Showing 1 of 132 issues in cli/cli
    ...

Users of Personal Access Tokens get a different notice:

    Warning: gh now requires the `read:org` OAuth scope.
    Visit https://github.com/settings/tokens and edit your token to enable `read:org`
    or generate a new token and paste it via `gh config set -h github.com oauth_token MYTOKEN`
2020-04-23 18:20:21 +02:00
Mislav Marohnić
84ac3d412e Fix gh updater mechanism for unauthenticated users
Per code documentation: "BasicClient returns an API client that borrows
from but does not depend on user configuration". This means that any
errors while reading `oauth_token` should be tolerated.
2020-04-23 15:41:37 +02:00
Mislav Marohnić
8ed9a0324e Merge remote-tracking branch 'origin/master' into oauth-read-org 2020-04-23 15:35:35 +02:00
Corey Johnson
e68be52ed0 Use the correct field 2020-04-22 14:03:44 -07:00
Corey Johnson
4b2382c737 Merge branch 'heathy-helping' of https://github.com/cli/cli into heathy-helping 2020-04-22 14:02:09 -07:00
Corey Johnson
c9d5935ee3 move to use 2020-04-22 14:00:08 -07:00
Corey Johnson
4dff85d3c1 Merge remote-tracking branch 'origin/master' into heathy-helping 2020-04-22 13:56:53 -07:00
Corey Johnson
c064b07e6d Add quote 2020-04-22 13:51:35 -07:00
Corey Johnson
0d79257312
use backets
Co-Authored-By: Amanda Pinsker <ampinsk@github.com>
2020-04-22 13:50:52 -07:00
Corey Johnson
833f8b4f2c
Update command/root.go
Co-Authored-By: Amanda Pinsker <ampinsk@github.com>
2020-04-22 13:50:06 -07:00
Corey Johnson
6d20283a7a Move feedback to the bottom 2020-04-22 13:49:42 -07:00
Corey Johnson
b5299ef5d7
pointy brackets ftw
Co-Authored-By: Amanda Pinsker <ampinsk@github.com>
2020-04-22 13:46:51 -07:00
vilmibm
bec58ede98 respect ssh
this adds recognition of the git_protocol setting when:

- creating a repo
- cloning a repo
- forking a repo
- forking/pushing during pr create
- checking out a PR

additionally, it:

- consolidates remote adding to use AddRemote; this introduces a fetch
where there previously hadn't been one
- changes repo clone to accept an ssh url
- changes repo fork to accept an ssh url

i just added basic unit tests; adding new test cases for all of the
above scenarios seemed like diminishing returns.
2020-04-22 14:21:01 -05:00
Corey Johnson
a4429aae41 rearrange code 2020-04-22 10:00:33 -07:00
Corey Johnson
be51d095ea Separating core from non-core commands 2020-04-21 13:30:07 -07:00
vilmibm
d4dd4a68bf fix error handling 2020-04-21 11:25:23 -05:00
vilmibm
c4693077aa move config stuff to its own package 2020-04-20 13:57:16 -05:00
vilmibm
815f461e8b more strict erroring around missing user/token 2020-04-20 12:49:46 -05:00
vilmibm
a325db3051 new config infrastructure
- adds config get and config set commands
- supports arbitrary k/v strings set at top and host level
- supports writing an updated config, preserving comments
- supports mostly lazy evaluation of yaml
2020-04-17 15:17:44 -05:00
Mislav Marohnić
3d566dc5a6 Detect and warn about read:org OAuth scope being missing 2020-04-15 17:25:15 +02:00
Mislav Marohnić
734497a8d8
Code fixes informed by golangci-lint failures (#738) 2020-04-03 16:33:34 +02:00
Dmitry Sharshakov
d755288cdf Implement review comments 2020-03-17 20:05:53 +03:00
Dmitry Sharshakov
45c2a16d49 Don't list remotes when --repo flag is set 2020-03-14 23:14:38 +03:00
Mislav Marohnić
7c11f7655a No need to opt in to shadow-cat API preview
This was needed for draft pull requests, but these APIs were public
since Feburary 2020.
2020-03-10 13:59:56 +01:00
Mislav Marohnić
42b40b1179 No longer need to opt into pe_mobile API flag
`pe_mobile` was required to get access to `reviewDecision` and
`statusCheckRollup`, but both are now public in GitHub API.
2020-03-10 13:58:06 +01:00
Christian Muehlhaeuser
fdfcecfcb6 Fix typo in 'overridden' 2020-03-04 14:20:55 +00:00
Mislav Marohnić
371d4f5c6a Ensure that gh <command> -h is equivalent to --help
This compensates for what appears to be a bug in Cobra, which only
handles `pflag.ErrHelp` unless the error is wrapped. It also might be
that Cobra doesn't recognize Go 1.13-style error wrapping.
2020-03-03 20:05:44 +01:00
Dasio
19cc79cac8 Removed explicit capacity in slice initialization 2020-02-26 15:44:52 +01:00