Commit graph

553 commits

Author SHA1 Message Date
ffalor
665e4e3446
Add new commands issue pin and issue unpin (#5597) 2022-08-31 10:16:45 +00:00
Sam Coe
117929c57e
Always send GraphQL-Features: merge_queue with graphql requests 2022-08-18 21:50:00 +03:00
Sam Coe
45f1a71c8b
Remove all direct calls to shurcool-graphql 2022-08-18 21:40:41 +03:00
Mislav Marohnić
d21d388b8d
Restore old GH_DEBUG=1 behavior for HTTP logging (#6054)
- No HTTP bodies or headers are logged until `GH_DEBUG=api` is used.
- Logging to terminal now supports colorization.
2022-08-10 17:59:13 +02:00
Mislav Marohnić
92b7a30540
Merge pull request #5994 from cli/parse-remotes
Fix parsing base repo out of outdated git remotes
2022-07-26 12:20:18 +02:00
Sam Coe
2cdb9d34d4
Use SkipDefaultHeaders option (#5996) 2022-07-26 07:15:50 +02:00
Mislav Marohnić
e7029616cb Fix parsing base repo out of outdated git remotes
If any of the repositories named by git remotes could not be found via
API lookup, a "could not resolve to a Repository" error would be thrown,
but the goal of the base repo logic was to ignore NOT_FOUND errors.
2022-07-25 20:17:32 +02:00
Mislav Marohnić
c22a85e2b5 Remove accidental caching from repo list and other commands
Any gh command that has invoked NewCachedHTTPClient has also
inadvertently enabled caching for the original `http.Client` due to the
nature that NewCachedHTTPClient mutates the original argument passed.
2022-07-14 19:10:32 +02:00
Sam Coe
9d70d62520
Set blank headers so they are not automatically resolved by go-gh (#5935) 2022-07-14 14:13:34 +02:00
Sam Coe
e5cf302ad8
Post go-gh integration cleanup (#5933) 2022-07-13 14:58:50 +02:00
Mislav Marohnić
dea1af1227
pr checks: avoid deduplicating same-named checks under different workflows (#5919) 2022-07-12 09:48:39 +00:00
Mislav Marohnić
5656296ade repo fork: directly fork under the desired name
A new GitHub feature landed where the API client can specify the desired
name of the new fork. This avoids the necessity of subsequently having
to rename the forked repo after the fork operation has created one.

For backwards compatibility, the renaming logic is still here, but
activates only if the resulting repo name is not the desired name.
2022-07-11 13:54:58 +02:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Sam Coe
074ed50b8a
Integrate go-gh API package (#5614) 2022-06-23 04:05:31 +01:00
ffalor
2388f51927
Add --match-head-commit field to gh pr merge (#5692)
Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
2022-06-20 17:18:00 +02:00
Jonathan Fenwick
ddb408e67b
Add check to see if current owner is attempting to fork the repo (#5794)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-06-14 13:13:24 +00:00
Ariel Deitcher
53a8737c87 pr merge: add support for Merge Queue
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-06-08 12:24:36 +02:00
Sam Coe
539b150833
Extract feature detection package (#5494) 2022-05-17 19:07:44 +00:00
Heath Stewart
5ed83e2b2a
Remove Stringer from ghrepo.Interface (#5536) 2022-04-28 08:58:34 +02:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Heath Stewart
19a852ae9f
Add label clone command (#5452) 2022-04-25 18:13:22 +00:00
nate smith
a3fba669bd add and use RESTWithNext 2022-03-29 10:15:33 -05:00
Gowtham Munukutla
83a6cccf2a
Add interactive repository edit functionality (#4895) 2022-03-14 17:49:03 +00:00
Mario Campos
97ea5e77b4
Fix obtained scope mapping to include implied scopes (#5256)
* Fix obtained scope mapping to include missing scopes

As is, `gotScopes` does not contain certain scopes because it doesn't check for the "special" scopes that imply other scopes. For example, the `repo` scope implies `repo:invite`.

* Add a comment in ScopesSuggestion explaining branch statements

* Delete whitespace to appease go-fmt
2022-03-01 14:37:58 +00:00
Sam Coe
28d2b52769
release create: warn about unpushed local git tag (#5104)
If `gh release create <TAG>` was called and TAG exists locally but not on the remote, this warns about the unpushed tag to avoid recreating it on the remote. The user can pass a value for `--target` to silence the warning.
2022-02-15 16:36:37 +01:00
Nate Smith
3a088e4df5
Merge pull request #5069 from hirasawayuki/fix-pr-checks-cmd
Fix duplicates check results returned by `gh pr checks`
2022-01-26 16:46:32 -06:00
nate smith
bd6e50a08a Merge remote-tracking branch 'origin/trunk' into feature/target-repo-fork-name 2022-01-25 14:08:27 -06:00
Des Preston
2e07d0f32c
pr status: show number of approvals (#4240)
If the base branch has no minimum approval requirements, show "N Approved"
reviews. Otherwise, show "N/X Approved".

Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-01-21 15:58:15 +00:00
Mislav Marohnić
4340c65ad9
Merge pull request #5040 from cli/issues-by-milestone-fix
Fix filtering issues by milestone
2022-01-21 14:47:40 +01:00
hirasawayuki
b0fd9c6f04 Fix duplicates check results returned by gh pr checks 2022-01-21 00:02:42 +09:00
Mislav Marohnić
66c18b40f2
Handle SAML enforcement challenge from the server (#5054)
Whenever a SSO challenge gets issued by the server by means of a URL in
the `X-GitHub-SSO` response header, gh now additionally prints that URL
on the standard error stream.

This is achieved by installing a middleware to all HTTP requests and
storing the server challenge to a value accessible by `factory.SSOURL()`.
Such approach was made necessary mainly because of the
`shurcool-graphql` client which doesn't give access to response headers
when a GraphQL error case is encountered.
2022-01-19 14:22:22 +01:00
Mislav Marohnić
d23460a590 Fix filtering issues by milestone
The milestone filter in the `Repository.issues` GraphQL connection is
broken, so switch to the Search API for any milestone filtering.

Previously, we used to work around this by obtaining the milestone
database ID from decoding the GraphQL ID, but that no longer works since
the GraphQL ID format has changed.
2022-01-14 15:06:33 +01:00
Carl Tablante
ad8d7bb02e
#4386 Display a user's name in metadata survey for assignees and reviewers (#4420)
Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
2022-01-12 08:52:22 +00:00
Gowtham Munukutla
759e8a9ca9 resolve conflicts with trunk 2021-12-15 13:25:36 +05:30
Benjamin Chadwick
4bbbf46321
Fix browse last commit when using the repo override flag (#4845) 2021-12-13 15:00:22 +01:00
Gowtham Munukutla
3fb4c481dc modify tests 2021-12-11 10:17:04 +05:30
Gowtham Munukutla
54d92facbf add flag to set fork-name during repo fork. Tests WIP 2021-12-10 22:59:35 +05:30
Mislav Marohnić
0e3c3bb4a4
pr view: ensure that PR reviews are always rendered in --comments mode (#4848)
The GraphQL query for review didn't use to request the `TotalCount`
field, but that field was checked before rendering the conversation
thread in `pr view --comments`. This fixes rendering the conversation
thread when a PR only has reviews but no ordinary comments.
2021-12-03 18:07:27 +01:00
Des Preston
8f9548fd37
Ignore scope suggestions for http 422 (#4809)
HTTP 422 messages are for validation errors, but OAUTH permissions
suggestions get printed anyways. Most times, the user probably has the
right permissions. This fix adds the check to avoid printing a confusing
message.

Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-12-01 18:13:48 +00:00
Mislav Marohnić
34fc5fb75c Improve issue view re: overfetching, PR support
- Supports passing a PR as argument, not just issues
- Makes it non-fatal when project cards were not able to load
- Cleans up legacy method for fetching issues
2021-11-24 18:49:36 +01:00
Mislav Marohnić
c8d5a6be02 Accept pull requests in issue edit argument 2021-11-23 20:39:19 +01:00
Mislav Marohnić
5be6b67ce7 Remove overfetching from issue delete 2021-11-23 19:39:40 +01:00
Mislav Marohnić
f99a149eb2 Improve issue reopen re: overfetching, handling PRs
- `issue reopen` no longer fetches all issue fields and thus avoids the
  problem when loading failed due to token not having access to projects

- `issue reopen` now accepts either issue or pull number as argument.
2021-11-23 19:39:40 +01:00
Mislav Marohnić
07cad386a5 Improve issue close re: overfetching, handling PRs
- `issue close` no longer fetches all issue fields and thus avoids the
  problem when loading failed due to token not having access to projects

- `issue close` now accepts either issue or pull number as argument.
2021-11-23 19:38:55 +01:00
Mislav Marohnić
1eb790cacd Improve issue comment re: overfetching, handling PRs
- `issue comment` no longer fetches all issue fields and thus avoids the
  problem when loading failed due to token not having access to projects

- `issue comment` now accepts either issue or pull number as argument.
2021-11-23 16:40:14 +01:00
Sam Coe
260716a9f8
Repace shurcool/graphql with cli/shurcool-graphql 2021-11-17 12:57:43 -08:00
Mislav Marohnić
83a08aa3ba Remove unnecessary pointers to Go maps 2021-10-25 17:20:12 +02:00
Mislav Marohnić
2c3f02ee62 Ensure NOT_FOUND error when querying private repos using insufficient scope 2021-10-14 17:31:21 +02:00
Mislav Marohnić
2ca18e0600 Warn about missing OAuth scopes when reporting HTTP 4xx errors
If a 4xx server response lists scopes in the X-Accepted-Oauth-Scopes
header that are not present in the X-Oauth-Scopes header, the final
error messaging on stderr will now include a hint for the user that they
might need to request the additional scope:

    $ gh codespace list
    error getting codespaces: HTTP 403: Must have admin rights to Repository. (https://api.github.com/user/codespaces?per_page=30)
    This API operation needs the "codespace" scope. To request it, run:  gh auth refresh -h github.com -s codespace
2021-10-13 23:24:14 +02:00
Parth
ec554822b8
Add repo archive command (#4410)
Co-authored-by: meiji163 <mysatellite99@gmail.com>
2021-10-12 12:48:40 +02:00