Commit graph

63 commits

Author SHA1 Message Date
vilmibm
121173c330 better error reporting + catch for empty repo 2020-03-23 15:21:58 -05:00
Mike Rogers
caf12adef1 unusally > unusually 2020-03-07 20:44:14 +00:00
Nate Smith
3d7733870e
Merge branch 'master' into repo-fork 2020-03-03 15:40:54 -06:00
vilmibm
ded870714f add SetAuthLogin helper to blank context 2020-02-25 16:26:51 -06:00
Dasio
9289ab99f2 Use var syntax when empty struct is initialized 2020-02-24 22:33:22 +01:00
Dasio
8aa46c236e Init slice with provided capacity if it's known in advance 2020-02-24 22:16:41 +01:00
Mislav Marohnić
4727fc4659 Ensure descriptive error when no github.com remotes found 2020-02-20 22:30:25 +01:00
Yash Ladha
4ee995dafd
fix(486): Getting issue list on no remotes specified
Fixes: #486
2020-02-21 02:14:20 +05:30
Mislav Marohnić
72bde685b0 Add back comments explaining OAuth app credentials 2020-02-18 19:31:18 +01:00
Colin Arnott
213f4a5333 context: use the real oauth credentials
It is trivial to extract this information from the released artefacts,
thus there is no security benefit to the safe/development credentials.
This approach also prevents users from using go-get to install.

As proof of concept, and to enable go-get, this change embeds
the GitHub CLI credentials, instead of GitHub CLI (dev).
2020-02-18 19:31:01 +01:00
vilmibm
c8a4ac66d8 start on fixing tests 2020-02-11 21:56:20 -06:00
vilmibm
f653dbb6b5 wrap and reuse the resolveToRemotes code from PR commands 2020-02-11 19:33:04 -06:00
vilmibm
22be13d8d5 move resolveRemotesToRepos to context 2020-02-11 19:33:04 -06:00
Borna Butkovic
f0d8c65194 pr view, status, list parent repo instead of fork 2020-02-11 19:33:04 -06:00
Mislav Marohnić
8453bf679c Fix parsing non-GitHub remotes
Otherwise, the remote URL translation mechanism had crashed when
encountering a non-Github.com git remote.
2020-01-28 19:51:44 +01:00
Mislav Marohnić
a710893fc1 Rename to cli/cli 2020-01-24 16:08:52 +01:00
Mislav Marohnić
22fe0839fa Merge remote-tracking branch 'origin/master' into ghrepo-interface 2020-01-23 14:19:10 +01:00
Mislav Marohnić
4f6dfee965 Merge remote-tracking branch 'origin/master' into pr-create-just-works-TM 2020-01-23 14:08:07 +01:00
Amanda Pinsker
ea09883b07 Restyle auth page 2020-01-22 14:45:31 -08:00
Mislav Marohnić
1f90579d2a Extract common interface for a GitHub Repository
Also define a handful of utility methods:
- `New(owner, repo)`
- `FullName`: the name slash owner pair
- `FromFullName`: parse the name slash owner pair
- `FromURL`: parse a GitHub.com URL
- `IsSame(r1, r2)`: compare two repositories
2020-01-22 22:44:46 +01:00
Mislav Marohnić
7a614ce697 Support triangular git workflows in pr create
- The local git remotes are scanned and resolved to GitHub repositories
- The "base" repo is the first result resolved to its parent repo (if a fork)
- The name of the default branch is read from the base repo
- The "head" repo is the first repo that has push access
2020-01-21 18:26:08 +01:00
Nate Smith
bf209d88a6 Merge pull request #222 from github/oauth-debug
Improve OAuth flow
2020-01-13 18:03:32 -06:00
Mislav Marohnić
853fda13e9 Add more OAuth flow debugging to stderr with DEBUG=oauth 2020-01-13 20:31:31 +01:00
Nate Smith
c5486ee3f2 Merge pull request #210 from github/noprinting
minor text edits
2020-01-13 12:19:01 -06:00
Tiernan L
204e902dba browser is sufficient 2020-01-09 15:27:39 -10:00
Nate Smith
05b92dbb95 Merge pull request #168 from github/goodbye-migration
Remove migration function
2019-12-19 15:19:01 -06:00
Mislav Marohnić
f0801b2deb Simplify reading current branch from git 2019-12-17 14:45:24 +01:00
Corey Johnson
63f35f6834 goodbye migration 2019-12-16 15:56:45 -08:00
Corey Johnson
d1905f5824 update comment 2019-12-13 16:17:28 -08:00
Corey Johnson
9becb5f790 Have one place manage the config dir location 2019-12-13 16:16:46 -08:00
Corey Johnson
7c1390d02d Merge pull request #131 from github/move-config-to-folder
Move config to a directory
2019-12-04 15:53:34 -08:00
Corey Johnson
ae68acb901 Move to context package 2019-12-04 15:39:25 -08:00
Corey Johnson
b6adf7f4b1 Merge branch 'master' into upgrade-gh-reminder 2019-12-04 09:55:23 -08:00
Mislav Marohnić
87a1490d1e Improvements to update notifier authentication
- Check for updates even if `~/.config/gh` does not exist. In this case,
  the API call is unauthenticated.

- Avoid having the update notifier ever triggering the OAuth flow.
2019-12-04 15:41:08 +01:00
Corey Johnson
4b9cca3129 Change where the config file is located 2019-12-03 16:36:35 -08:00
Mislav Marohnić
db8c2d4e01 Merge remote-tracking branch 'origin/master' into pr-current-branch 2019-12-02 18:56:11 +01:00
Mislav Marohnić
d99698f048 Fix minor code issues discovered by staticcheck
`honnef.co/go/tools/cmd/staticcheck`
2019-11-26 16:18:20 +01:00
Mislav Marohnić
eff8847513 Improve detecting PR for the current branch
Now reads git branch configuration and handles these cases:

    branch ["foo"]
      remote origin
      merge  refs/heads/bar

    branch ["foo"]
      remote other-remote
      merge  refs/heads/foo

    branch ["foo"]
      remote https://github.com/OWNER/REPO.git
      merge  refs/heads/bar

    branch ["foo"]
      remote origin
      merge  refs/pull/123/head
2019-11-20 15:20:36 +01:00
Mislav Marohnić
4fab43a667 Cover more pr checkout test scenarios 2019-11-14 20:53:34 +01:00
Mislav Marohnić
dc0de147c9 Add pr checkout command 2019-11-14 19:59:42 +01:00
Mislav Marohnić
65054fdc6e Complete pr create test 2019-11-11 15:01:41 +01:00
Mislav Marohnić
e7bebaeebc Inject production OAuth client ID+secret into release 2019-11-08 18:57:22 +01:00
Mislav Marohnić
39a6feba9c Now able to use api in oauth flow 2019-10-29 21:16:35 +01:00
Mislav Marohnić
f786802e9e Customizable API client 2019-10-29 21:07:03 +01:00
Mislav Marohnić
8370602f49 WIP eliminate package-level state in commands, context 2019-10-25 21:49:08 +02:00
Mislav Marohnić
641de86427 Eliminate package-level state in git remote parsing 2019-10-25 21:48:25 +02:00
Mislav Marohnić
5aca575964 Wire up OAuth authentication flow to initialize config file
The config file is now `~/.config/gh`.
2019-10-18 19:08:11 +02:00
Mislav Marohnić
2aa77fb8ea Add Context.SetAuthToken 2019-10-18 18:47:42 +02:00
Mislav Marohnić
d334d56f09 Test FindByName 2019-10-17 16:10:45 +02:00
Mislav Marohnić
51c70dd918 Add test for invalid remote URLs 2019-10-17 16:05:25 +02:00