Commit graph

529 commits

Author SHA1 Message Date
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
Mislav Marohnić
e4c8aa3b2b Add tests for pr diff --patch 2021-10-08 13:53:19 +02:00
Adarsh K Kumar
e0897fd8e8 #2720 | Add patch flag to pull-request diff command 2021-10-07 23:09:21 +05:30
Mislav Marohnić
619333adb6 Avoid using error values to pass information about the search cap 2021-09-06 16:09:18 +02:00
Des Preston
e8b015b80d show warning when limit exceeds search api max
Fixes #3839
2021-09-06 16:05:11 +02:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
3e23dcab15 Fix HTTP 502 error reporting from GraphQL request
Now it makes sure that the message portion will be printed to stderr
when the user encounters the error.
2021-08-18 22:17:32 +02:00
Mislav Marohnić
90b7886142 Fix unmarshalling GraphQL error type
The "path" field of a GraphQL error object contains a mix of strings and
numbers and cannot be deserialized into `[]string`. Fortunately, we
don't need to rely on the "path" field and instead have the final error
message be constructed by aggregating human-readable "message" fields.
2021-08-04 15:34:53 +02:00
Sam Coe
e5b099b1dd
Fix bug where branchProtectionRule doesn't exist in enterprise 2.22 2021-06-30 09:47:30 -07:00
Gowtham Munukutla
a44a3c8fd0 remove redundant logs 2021-06-17 10:41:24 +05:30
Gowtham Munukutla
9b05254285 gofmt 2021-06-17 10:28:24 +05:30
Gowtham Munukutla
acaaeb5567 remove unnecessary assignment of id 2021-06-17 10:27:40 +05:30
Gowtham Munukutla
26105dec29 fix lint 2021-06-17 10:25:54 +05:30
Gowtham Munukutla
137053399e tweak tests and add extra validations 2021-06-17 10:17:26 +05:30
Gowtham Munukutla
3c8e163e8b resolve PR comments. Tests WIP 2021-06-16 12:50:05 +05:30
Gowtham Munukutla
7c8b6867f4 Merge branch 'trunk' of https://github.com/cli/cli into feature/repo-with-gitignore-license 2021-06-16 09:27:53 +05:30
Mislav Marohnić
a4d1ce7709 Fix fetching information about the PR potentially being behind base branch 2021-06-10 15:51:27 +02:00
Mislav Marohnić
885e94786a Shorten GraphQL query for pr status --json 2021-06-10 15:37:58 +02:00
Mislav Marohnić
f5cd33b4bf Fix showing Checks in pr status
This was a regression in how `statusCheckRollup` is queried and stored.
As a result, `gh pr status` did not include rendered information about
checks related to each pull request. This switches the query builder to
`PullRequestGraphQL()` to eliminate the outdated query.
2021-06-08 20:22:33 +02:00
Gowtham Munukutla
c4beed8276 complete tests 2021-05-30 13:42:39 +05:30
Gowtham Munukutla
9b87b13b80 add test cases WIP 2021-05-29 19:27:30 +05:30
Mislav Marohnić
1a980e768c Fix how teams are displayed in requested reviewers
1. The `--json` export now only renders the `login` field for User types
   and `name` and `slug` fields for Team types.
2. The `pr view` command now renders team reviewers in the format of
   `ORG/SLUG` instead of the team name. This is so that the same value
    can be used in the `pr create -r` flag.
2021-05-28 14:32:31 +02:00
Sam Coe
761fa94831
Small nitpicky polish 2021-05-27 08:47:41 -04:00
mercimat
a612f06dee fix pr review requests for teams 2021-05-24 17:00:25 +02:00
Mislav Marohnić
6bec7a956a Fix pr merge on GHE < 3.0
This avoids loading authorship information for git commits, since it
relies on a GraphQL API that wasn't available before GHE v3.0. The
authorship information wasn't necessary for the merge operation anyway;
just loading the last commit OID was.
2021-05-21 17:35:41 +02:00