Commit graph

20 commits

Author SHA1 Message Date
Kynan Ware
7382b86c1a Fetch org teams via repository.owner inline fragment
Replace the top-level organization(login: $owner) query with
repository.owner { ... on Organization { teams } }. This uses
GraphQL inline fragments to conditionally fetch team data only
when the repo owner is an Organization, eliminating the need to
handle 'Could not resolve to an Organization' errors for
personal repos.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 09:47:47 -07:00
Kynan Ware
24fb7657cd Exclude PR author from reviewer candidates in SuggestedReviewerActors
Add author { login } to the SuggestedReviewerActors GraphQL query
and pre-seed the seen map with the author login so they are excluded
from all sources (suggestions, collaborators, teams). Previously the
author was only skipped via the isAuthor flag in the suggestions loop
but could still appear as a collaborator.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 15:53:50 -07:00
Kynan Ware
90bfa624c2 Exclude current user from suggested reviewers in gh pr create
Query the viewer login in SuggestedReviewerActorsForRepo and
pre-seed the seen map so the current user is filtered out of
collaborator results. You cannot review your own PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 15:36:48 -07:00
Kynan Ware
9904f7d1b9 gh pr create: CCR and multiselectwithsearch 2026-02-04 14:56:05 -07:00
Kynan Ware
c8b1409803 Use unfiltered totalCount for reviewer 'more results' display
Query aliased fields without search filter to get stable counts.
2026-01-29 12:54:04 -07:00
Kynan Ware
2d191e5ba0 Implement cascading quota for reviewer suggestions
Each source (suggestions, collaborators, teams) has base quota of 5.
Unfilled slots cascade to later sources, allowing up to 15 total.
Adds unit tests with HTTP mocks.
2026-01-29 11:30:08 -07:00
Mislav Marohnić
1e295607d7 Fix deleting remote branches with # in their name 2022-09-14 16:19:33 +02:00
Sam Coe
074ed50b8a
Integrate go-gh API package (#5614) 2022-06-23 04:05:31 +01:00
Sam Coe
539b150833
Extract feature detection package (#5494) 2022-05-17 19:07:44 +00:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +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ć
9bdc63c4ca Eliminate API overfetching in pr commands
This completely rewrites the PR lookup mechanism so that the caller
must specify the GraphQL fields to query for each PR. Additionally, this
fixes some export problems with `pr view --json`.

Features:

- Each pr command now gets assigned a concept of a Finder. This makes it
  easier to stub the PR in tests without having to stub the underlying
  HTTP calls or git invocations.

- `pr view --web` is much faster since it only fetches the "url" field.

- `pr diff 123` now skips a whole API call where a whole PR was
  unnecessarily preloaded just to access its diff in a subsequent call.

- PullRequestGraphQL query builder is now used to construct queries.

- A bunch of individual commands are now freed of having to know about
  concepts such as BaseRepo, Branch, Config, or Remotes.
2021-04-30 20:34:36 +02:00
Mislav Marohnić
dcff6c4f2d Fix pr status for GHE 2.22 and older
This queries for the availability of the `branchProtectionRule` field on
"Ref" before trying to request it from GraphQL.
2021-02-18 17:46:13 +01:00
Mislav Marohnić
d09561d03c 💅 simplify sortPullRequestsByState 2020-10-28 15:50:59 +01:00
Ian Billett
0f61272333 Allow PullRequestForBranch to search in closed pull requests 2020-10-28 15:50:59 +01:00
Mislav Marohnić
93c8fc1e98 Add tests for GraphQL introspection 2020-10-01 16:33:56 +02:00
Mislav Marohnić
7a289861d2 Name more queries in test stubs 2020-07-10 20:20:33 +02:00
Mislav Marohnić
1ca3d171e6 Tweak HTTP 422 handling when deleting branches 2020-06-30 19:21:39 +02:00
Pavel Borzenkov
3afec6f90a api: gracefully handle already deleted remote refs
If a GitHub repo is configured to automatically delete branches after PR
is merged, `gh pr merge` fails with error like:

failed to delete remote branch: ... (422): 'Reference does not exist'

Gracefully handle such case and don't report the error.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2020-06-27 19:10:42 +03:00