Commit graph

264 commits

Author SHA1 Message Date
Andy Feller
bbc3d02cb3 Refactor tab completion test
This commit moves the `gh pr create` tab completion test closer to the logic rather than the commands that use it.

This should ensure that any command or flag that lists reviewers will present teams and users as expected.
2025-07-30 09:25:33 -04:00
Andy Feller
8f20f0ab53 Include org teams for PR reviewers
This commit enhances the following scenarios to include organization teams as pull request reviewers:

1. Interactive `gh pr create` during additional metadata
2. Tab completing `gh pr create --reviewer`
3. Tab completing `gh pr edit --add-reviewer`
4. Tab completing `gh pr edit --remove-reviewer`

Additionally, a new `gh pr create` test case for ensuring that teams show up within interactive prompts has been added.
2025-07-29 18:19:22 -04:00
Kynan Ware
df317d4a05 FIX: conditionally fetching team reviewers
Updated the logic for fetching team reviewers in PR edit and create flows. In `pr edit`, team reviewers are always fetched for consistency with existing behavior, with a note to potentially align with `pr create` logic in the future. In `pr create`, team reviewers are now only fetched if a reviewer contains a slash, aligning with behavior before the regression.
2025-07-22 11:00:47 -06:00
Andy Feller
260519dc69
Merge pull request #11279 from cli/andyfeller/issue-create-assign-copilot
Assign Copilot during `gh issue create`
2025-07-16 17:01:32 -04:00
Andy Feller
973718712a Fix failing tests for Copilot replacement 2025-07-16 15:36:53 -04:00
Andy Feller
b433792a44 Fix copilot replace test names
In refactoring how this parameter works, I forgot to update the related tests to match.
2025-07-16 15:09:13 -04:00
Andy Feller
5cf3d3b9a5 Use constant for Copilot name
Based on PR feedback from @bagtoad, this commit creates a new constant for the Copilot bot name, which is used in the assignee / reviewer selection as well as replacing `@copilot` when going to GitHub.com UI
2025-07-16 15:06:43 -04:00
Andy Feller
4f0a5807bf Refactor CopilotReplacer logic based on PR feedback
Thanks to @bagtoad, this commit refactors the argument to `NewCopilotReplacer(bool)` from being where this is used to what it effect is has.

Because there is already precedence for display name being `<login> (<name>)`, I worried there would be confusion for `Copilot (AI)` being display name for assignees and reviewers but `Copilot` when going to GitHub.com UI.  Instead, I renamed the argument based on whether the login is returned / replaced.
2025-07-16 14:42:11 -04:00
Andy Feller
21202ff992 Improve comments from PR feedback 2025-07-16 08:47:12 -04:00
Andy Feller
554fe0f51f Fix gh issue create tests, copilot web assign
This commit is primarily focused on fixing the existing `gh issue create` tests with the changes to the underlying queries retrieving the data for resolving metadata.

Additionally, a new test case for `gh issue create --web --assignee @copilot` was added to mirror existing tests.  While exercising this capability, I found out the web UI apparently wants `copilot` instead of the `copilot-swe-agent` login, so changes to address that were a part of this commit.
2025-07-11 12:19:36 -04:00
Andy Feller
a8053d19a9 Resolve issue and PR metadata consistently
This commit refactors how `gh issue create` and `gh pr create` retrieve information needed to resolve metadata to be more in line with the approach used in `gh issue edit` and `gh pr edit`.

Previously, both commands used `prshared.fillMetadata(...)` function to retrieve assignees, reviewers, labels, and teams outside of `api.RepoMetadata(..)`.  Now, these commands will consistently use the same logic and data for resolving metadata.
2025-07-11 10:21:17 -04:00
Andy Feller
49821b20f9 Add non-TTY issue create copilot test, todos 2025-07-08 15:19:09 -04:00
Babak K. Shandiz
8ab5e84a12
test: add test for ParseURL
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-03 10:21:55 +01:00
Andy Feller
c69f828019 Initial assign Copilot during issue create changes
- updated command documentation for new `--assignee @copilot` syntax
- updated `gh issue create` logic with feature detection for actor availability
- fixed bug where `--assignee` would not select default assignees due to login vs display name mismatch
- updated survey prompt logic to avoid parsing prompt options in favor of correlating with assignee / actor source

One thing that is not included in these changes is incorporating the GraphQL mutation to replace assignees with actors, which I will continue iterating on.
2025-07-02 16:22:12 -04:00
Babak K. Shandiz
f65683784e
test: remove tests verifying assigne-related behaviour
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-01 11:12:58 +01:00
Babak K. Shandiz
12f4794151
fix: remove assignee-related intervention
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-01 11:12:16 +01:00
Babak K. Shandiz
23c9ff6d89
fix: expose ParseURL as a public func
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-01 10:49:18 +01:00
jinjingroad
28d5de9d8e chore: fix function name
Signed-off-by: jinjingroad <jinjingroad@sina.com>
2025-06-19 12:36:52 +08:00
Babak K. Shandiz
bde303dab2
test: fix test data const
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-06-10 13:57:31 +01:00
William Martin
793a7ff459 Fix pr edit when URL is provided 2025-06-02 15:07:55 +02:00
Kynan Ware
53d0d5d192 fix(editable): include DefaultLogins in EditableAssignees clone 2025-05-16 12:54:01 -06:00
Kynan Ware
6f1906073f
doc(params): incorrect func name in comment
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-16 12:51:09 -06:00
Kynan Ware
a28e2d8784 refactor(api): use constant for Copilot login 2025-05-16 12:28:46 -06:00
Kynan Ware
debf0bbaf2 test(params): enhance Copilot replacer tests for edge cases
- Added tests for handling nil and empty slices in the Copilot replacer.
- Simplified test structure by removing unnecessary wantErr field.
2025-05-16 09:50:24 -06:00
Kynan Ware
871671be52 fix(params): remove needless err return 2025-05-16 09:40:29 -06:00
Kynan Ware
c5f2d7bde7 doc(editable): remove needless comment 2025-05-16 09:37:20 -06:00
Kynan Ware
375c6cd28f feat(issue/pr edit): support @copilot in assignee flags
- Introduced CopilotReplacer to handle `@copilot` mentions in assignee lists.
2025-05-15 12:50:03 -06:00
Kynan Ware
51b1e6cd6f
Merge branch 'kw/gh-cli-909-911-assign-actors-to-prs' into kw/gh-cli-916-special-actor-assignee-names 2025-05-15 11:27:14 -06:00
Kynan Ware
52b6ebff9c doc(pr edit): Add comments describing the use of DefaultLogins 2025-05-15 10:52:31 -06:00
Kynan Ware
9a5ea87d75 fix(issues): fix non-interactive assignee matching to logins&IDs 2025-05-15 09:56:35 -06:00
Kynan Ware
6162a7c524 fix(api): correct var name capitalization 2025-05-15 09:33:36 -06:00
Kynan Ware
eace1e889a feat(editable): update assigned actors to use display names
- Refactored AssignedActors to return display names instead of logins.
- Updated related functions to ensure consistency in display names.
- Enhanced comments for clarity on display name logic and actor types.
2025-05-14 20:26:53 -06:00
Kynan Ware
5dc854c75e doc(issue edit): clarify synchronous handling of assignees 2025-05-14 11:50:11 -06:00
Kynan Ware
08cd1dc7db feat(issue edit): replacing actor assignee is done synchronously with updateIssue 2025-05-14 11:43:29 -06:00
Kynan Ware
dfd600713f refactor(api): rename assignable user types and methods 2025-05-14 08:53:47 -06:00
Kynan Ware
218152f7c5 fix(issue edit): resolve race condition in actor assignment 2025-05-09 23:26:06 -06:00
Kynan Ware
0efdfed068 feat(issue edit): support assigning actors to issues 2025-05-09 22:56:09 -06:00
Kynan Ware
ee9d169204 feat(issue edit): fetch assignable actors 2025-05-09 15:13:11 -06:00
Kynan Ware
7b86830ade
Merge pull request #10729 from nopcoder/trunk
Fix panic on `gh pr view 0`
2025-05-02 09:47:48 -06:00
William Martin
e995a873cb Feature detect v1 projects on non-interactive pr create 2025-05-02 15:08:34 +02:00
William Martin
c5d8e6f8f5
Merge pull request #10821 from cli/wm/projectsv1-deprecation-pr-view
Feature detect v1 projects on pr view
2025-05-02 15:07:40 +02:00
William Martin
64370ce73e Cleanup run command stubbed finders in tests 2025-05-02 14:48:52 +02:00
Barak Amar
232c024987
Merge branch 'trunk' into trunk 2025-05-01 22:16:55 +03:00
William Martin
3bcf9758ad Feature detect v1 projects on pr view 2025-05-01 15:31:36 +02:00
Sinan Sonmez (Chaush)
0a1e7a1fdc
Add --delete-last option to pr comment and issue comment (#10596)
* deletion for issues with confirmation flag

* add handling for interaction case

* finish implementation for issues

* finish the implementation for issues

* finalize the implementation for PR

* fix missing --yes flag for PR

* address PR comments related to feedbacks

* improve CommentablePreRun for pre checks

* improve confirmation prompt and truncate long comment body

* address PR comments on tests

* Truncate comment for confirmation prompt

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Improve test case descriptions

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Fix mock comment body

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Remove irrelevant prompt stub

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Use `opts.Interactive` as TTY indicator

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Fix expected `Interactive` value

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Polish `TestNewCmdComment`

Signed-off-by: Babak K. Shandiz <babakks@github.com>

---------

Signed-off-by: Babak K. Shandiz <babakks@github.com>
Co-authored-by: Babak K. Shandiz <babakks@github.com>
2025-05-01 14:12:55 +01:00
Barak Amar
a491578751
Merge branch 'trunk' into trunk 2025-04-29 14:33:21 +03:00
Barak Amar
692bdaf578 Apply code review changes 2025-04-29 14:32:51 +03:00
Azeem Sajid
9ed733fa5e
Add closingIssuesReferences JSON field to pr view (#10544)
* [gh pr view] Support `closingIssuesReferences` JSON field

* Support pagination

* Support pagination

* Fix typo

* Add more fields
2025-04-29 11:48:20 +01:00
Barak Amar
afba7b9e8b
Merge branch 'trunk' into trunk 2025-04-28 18:17:36 +03:00
William Martin
fb97b3efaa
Fix pr create when push.default tracking and no merge ref (#10863)
* Fix pr create when push.default tracking and no merge ref

* Update pkg/cmd/pr/shared/find_refs_resolution.go

---------

Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2025-04-24 16:41:14 +00:00