Commit graph

5446 commits

Author SHA1 Message Date
Kynan Ware
dd9ab7152b
Don't swallow error from FD
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-10 10:54:03 -07:00
Kynan Ware
620261fea4
Remove redundant comments 2026-02-10 10:53:30 -07:00
gunadhya
b38f6772e5 Fix issue develop repeated invocation with named branches 2026-02-09 23:31:22 +05:30
vishnuvv27
b32b7eab39 Fix redundant API call in gh issue view --comments (#12606) 2026-02-09 15:31:55 +05:30
Kynan Ware
9904f7d1b9 gh pr create: CCR and multiselectwithsearch 2026-02-04 14:56:05 -07:00
Kynan Ware
a9a0486c70 Clarify comment on reviewer API behavior
Update comment in FetchOptions to specify that the APIs used for both GHES and GitHub.com accept user logins and team slugs directly, clarifying why non-interactive flows with Add/Remove don't need to fetch reviewers/teams. Comment-only change; no functional modifications.
2026-01-30 11:33:22 -07:00
Kynan Ware
aac223ab71 Clarify assignee/reviewer fetching behavior
Add clarifying comment in pkg/cmd/pr/edit/edit.go to note that missing assignee/reviewer search functions trigger a downstream fallback to legacy fetching. In pkg/cmd/pr/shared/editable.go remove a redundant line and add a TODO urging migration of non-interactive assignee updates to use the new logins input with ReplaceActorsForAssignable to avoid unnecessary fetching. These are comment and doc changes to clarify intent and future improvements.
2026-01-30 11:29:11 -07:00
Kynan Ware
4569aae0e4 Clarify EditableReviewers comment
Remove a redundant struct-level comment and update the DefaultLogins field comment in pkg/cmd/pr/shared/editable.go to more accurately describe its purpose: used to disambiguate actors from display names rather than to compute add/remove sets.
2026-01-30 11:20:30 -07:00
Kynan Ware
d643d5386e fix(pr edit): send empty slices to clear reviewers in replace mode
Always send explicit lists for userLogins, botLogins, and teamSlugs
in RequestReviewsByLogin mutation, even when empty. Previously, empty
slices were omitted due to omitempty JSON behavior and len > 0 checks,
which prevented clearing all reviewers when using replace mode.

Empty slices are harmless no-ops in union mode, so we now send them
unconditionally for simpler logic.

Add test to verify the mutation receives empty slices when all
reviewers are removed.
2026-01-29 10:37:11 -07:00
Kynan Ware
846d6619b7 Remove redundant comment 2026-01-28 10:50:54 -07:00
Kynan Ware
738b82ddab Add CCR and reviewer MultiSelectWithSearch
Enables Copilot to be requested as a pull request reviewer, supporting both interactive and non-interactive flows. Introduces new reviewer search functionality, updates reviewer partitioning to distinguish users, bots, and teams, and adds a GraphQL mutation for reviewer management on github.com. Updates help text, tests, and internal APIs to support Copilot reviewer login and display names, while maintaining compatibility with GitHub Enterprise Server.
2026-01-27 23:11:51 -07:00
Kynan Ware
968a912a07 Remove outdated TODO comments in survey.go
Cleaned up obsolete TODO comments related to assignee and reviewer selection logic in the MetadataSurvey function.
2026-01-26 15:05:18 -07:00
Kynan Ware
a8053d6e93 Remove redundant comment in editRun test 2026-01-26 14:56:50 -07:00
Kynan Ware
28e07666f8 Return total assignee count in SuggestedAssignableActors
Updated SuggestedAssignableActors to return the total count of available assignees in the repository. Modified assigneeSearchFunc to use this count to calculate and display the number of additional assignees beyond the current results.
2026-01-26 14:33:45 -07:00
Kynan Ware
fb031b2b43 Add test for legacy assignee flow on GHES
Introduces a test case to verify that the interactive edit flow on GitHub Enterprise Server uses the legacy assignee selection without search, ensuring correct behavior when editing pull request assignees.
2026-01-26 13:48:23 -07:00
Kynan Ware
e3a3a01f2d Add comments to assigneeSearchFunc for clarity
Added detailed comments to the assigneeSearchFunc explaining its purpose and the importance of updating assignable actors metadata for later ID resolution when mutating assignees with the GraphQL API.
2026-01-26 13:29:22 -07:00
Kynan Ware
30cfbd9fdd Apply suggestions from code review
Co-authored-by: Babak K. Shandiz <babakks@github.com>
2026-01-26 13:29:22 -07:00
Kynan Ware
c0df49043f Clarify TODO comment for reviewer search function
Updated the TODO comment to specify wiring up the reviewer search function if or when it exists, providing clearer intent for future development.
2026-01-26 13:29:22 -07:00
Kynan Ware
ad8c770013 Only support assignee searchfunc on GitHub.com 2026-01-26 13:29:22 -07:00
Kynan Ware
07dfdf97ae Update edit tests
Updated test mocks and logic to consistently use lowercase 'monalisa' for login names and display names for user assignees. Improved handling of dynamic assignee fetching in interactive flows by relying on searchFunc and metadata population, and clarified logic in FetchOptions to fetch assignees only when necessary. These changes ensure more accurate simulation of interactive assignment and better test coverage for actor assignee features.
2026-01-26 13:29:22 -07:00
Kynan Ware
d46f42a752 Refactor MultiSelectWithSearch to use result struct
Refactored the MultiSelectWithSearch function and related interfaces to use a MultiSelectSearchResult struct instead of multiple return values. This change improves clarity and extensibility of the search function signature, and updates all usages, mocks, and tests accordingly.
2026-01-26 13:29:22 -07:00
Kynan Ware
7e7f8c6f6e Pass editable to assigneeSearchFunc and update metadata
The assigneeSearchFunc now receives the editable struct to update its Metadata.AssignableActors field with suggested assignable actors. This change ensures that the editable struct has the necessary actor metadata for later PR updates.
2026-01-26 13:29:22 -07:00
Kynan Ware
d04317c273 Add dynamic assignee search to PR edit flow
Introduces SuggestedAssignableActors API query and wires up a dynamic assignee search function in the PR edit command. Updates Editable and EditPrompter interfaces to support search-based multi-select for assignees, improving the user experience when assigning users to pull requests.
2026-01-26 13:29:22 -07:00
Kynan Ware
0beb74bf72 MultiSelectWithSearch initial implementation
Initial implementation of MultiSelectWithSearch:

- Implement by survey and accessible prompters. They use the same internal func under the hood.
- Implement in `gh preview prompter` for initial testing and demonstration
- Implement interface changes across the codebase and mocks to satisfy compiler.
- Implement tests for new MultiSelectWithSearch prompter
2026-01-26 13:29:22 -07:00
Kynan Ware
be1e21095c prshared: named prompt interface parameters
Updated the Prompt interface in survey.go to include parameter names for all methods, improving code readability and clarity.
2026-01-26 13:29:22 -07:00
Babak K. Shandiz
0d8a697c7c
fix(pr/shared): improve ParseFullReference error message
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2026-01-21 23:30:43 +00:00
Mikel Olasagasti Uranga
bd0177b039 Fix fmt.Errorf format argument in ParseFullReference
The error path passed an int to fmt.Errorf with %q, which expects a
string. Use the original reference string to avoid a format mismatch.

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
2026-01-21 23:14:59 +01:00
Kynan Ware
49f72234ac
Merge pull request #12376 from majiayu000/fix-11903-pr-create-same-ref
fix: error when head and base refs are identical in pr create
2026-01-21 10:21:14 -07:00
majiayu000
0f4b9b0d91
refactor: address review comments
Signed-off-by: majiayu000 <1835304752@qq.com>
2026-01-21 18:28:21 +08:00
Kynan Ware
3e8855f755
Merge pull request #12101 from davidspek/feat/delete-all-cache-ref
feat(cache delete): allow for delete all caches for a ref
2026-01-20 12:16:47 -07:00
Kynan Ware
c4fd102016
Merge branch 'trunk' into fix-11903-pr-create-same-ref 2026-01-20 10:33:17 -07:00
Babak K. Shandiz
da5e5ac6d4
test(copilot): fix windows asset URL
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2026-01-20 10:33:19 +00:00
David van der Spek
9cdc0c4fe5 fix(cache delete): add unit tests and expand help doc
Signed-off-by: David van der Spek <david.vanderspek@flyrlabs.com>
2026-01-20 08:30:34 +01:00
David van der Spek
6a798e76e1 feat(cache delete): allow for delete all caches for a ref
Signed-off-by: David van der Spek <david.vanderspek@flyrlabs.com>
2026-01-20 08:30:34 +01:00
Kynan Ware
d187bef56f Fix OS name in test archive filename to 'win32'
Replaces runtime.GOOS with 'win32' in the test archive filename within TestDownloadCopilot. This ensures the test uses the expected archive name for Windows.
2026-01-19 11:18:35 -07:00
Babak K. Shandiz
bc5a44a4ae
fix(copilot): replace windows with win32 to match asset names
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2026-01-19 17:57:05 +00:00
Babak K. Shandiz
10b4a1f427
fix(root): avoid command name collision when registering extensions
Signed-off-by: Babak K. Shandiz <babakks@github.com>

Co-authored-by: Kynan Ware <bagtoad@github.com>
Co-authored-by: Devraj Mehta <devm33@github.com>
2026-01-19 10:38:39 +00:00
Babak K. Shandiz
08a4413614
chore(root): register copilot command
Signed-off-by: Babak K. Shandiz <babakks@github.com>

Co-authored-by: Kynan Ware <bagtoad@github.com>
Co-authored-by: Devraj Mehta <devm33@github.com>
2026-01-19 10:38:35 +00:00
Babak K. Shandiz
39880650d5
feat: add copilot command
Signed-off-by: Babak K. Shandiz <babakks@github.com>

Co-authored-by: Kynan Ware <bagtoad@github.com>
Co-authored-by: Devraj Mehta <devm33@github.com>
2026-01-19 10:38:29 +00:00
Babak K. Shandiz
0f32f2ac46
refactor(run download): extract zip extraction func into a separate package
Signed-off-by: Babak K. Shandiz <babakks@github.com>

Co-authored-by: Kynan Ware <bagtoad@github.com>
Co-authored-by: Devraj Mehta <devm33@github.com>
2026-01-19 10:38:21 +00:00
lif
1d506f5331
fix: simplify set-default remote parsing 2026-01-14 18:35:04 +08:00
lif
8de78e6410
Merge branch 'trunk' into fix-9149-set-default-remote-name 2026-01-10 11:08:42 +08:00
majiayu000
5f305e81c2
Handle repo argument before remote name 2026-01-10 00:54:51 +08:00
fchimpan
5761a1e669
Update actions/checkout to v6 in extension workflow templates 2025-12-30 23:39:34 +09:00
majiayu000
73c7fd59ef feat: allow git remote names in gh repo set-default
When specifying a repository for `gh repo set-default`, users can now
use a git remote name (e.g., "origin", "upstream") instead of the
full OWNER/REPO format.

The command first checks if the argument is a git remote name. If
found, it uses the corresponding repository. Otherwise, it falls
back to parsing the argument as OWNER/REPO format.

Example:
  gh repo set-default origin

Fixes #9149

Signed-off-by: majiayu000 <1835304752@qq.com>
2025-12-26 19:21:11 +08:00
majiayu000
9daa22ebac fix: error when head and base refs are identical in pr create
When a user runs `gh pr create` with head and base refs pointing to
the same ref in the same repository, the command now exits with an
error instead of proceeding with an invalid PR creation.

This prevents accidental pushes to the main branch and provides clear
feedback when users attempt to create a PR from the base branch.

Cross-repository PRs (e.g., from forks) with the same branch name
continue to work as expected.

Fixes #11903

Signed-off-by: majiayu000 <1835304752@qq.com>
2025-12-26 19:14:06 +08:00
majiayu000
3f0044fd94 fix: error when --remote flag used with repo argument
When a repository argument is provided to `gh repo fork`, the command
operates independently of the current local repository. Using --remote
in this context is incompatible because there's no local repository to
add the remote to.

This change returns an explicit error when these flags are combined,
providing clear feedback instead of silently ignoring the --remote flag.

Fixes #2722

Signed-off-by: majiayu000 <1835304752@qq.com>
2025-12-26 14:43:52 +08:00
Robin Neatherway
a1fbfba9e1 Add tests of browse --actions 2025-12-11 11:31:12 +00:00
Robin Neatherway
786d276bfb Add gh browse --actions flag 2025-12-11 10:33:01 +00:00
ferhat elmas
70470f9cef refactor: drop multierror in favor of std
Drop github.com/hashicorp/go-multierror
in favor of https://pkg.go.dev/errors#Join (go1.20).

Related to #11468

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
2025-12-02 15:08:58 +01:00