Commit graph

927 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
c9bc185209 Test gh pr create --reviewer tab completion 2025-07-30 09:16:44 -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
5a6cac3643 Add tests for reviewer team handling in PR creation
Added test cases to verify that teams are fetched when reviewers include teams and not fetched when only users are specified. This ensures correct behavior when requesting reviews from users and teams during pull request creation.
2025-07-23 10:15:30 -06: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
1eeb797975
Revert "Fix: gh pr create prioritize --title and --body over --fill w…"
This reverts commit b31f38c946.
2025-07-14 17:23:09 -04:00
Andy Feller
fd1c31de59 Fix gh pr create tests from metadata change
These are the minimum fixes necessary to repair `gh pr create` tests after refactoring the underlying metadata resolution logic.
2025-07-11 15:32:17 -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
3e946a356c
test(pr merge): always assert stderr
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-05 15:02:41 +01:00
Babak K. Shandiz
b1e1c8d500
test(pr merge): verify deleteRemoteBranch behaviour when API returns error
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-05 14:54:33 +01:00
Babak K. Shandiz
bafefb345e
fix(pr merge): ignore 404 as error when deleting remote branch
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-05 14:54:28 +01: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
b7fa5ea7a9
docs: explain PR URL parsing reason
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-01 11:41:07 +01:00
Babak K. Shandiz
58ed691a6c
test: remove references to AssignedActorsUsed field
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-01 11:19:13 +01:00
Babak K. Shandiz
2c86246a1a
test: verify providing a URL arg affects the base repo
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-01 11:18:38 +01:00
Babak K. Shandiz
b85dc94f84
refactor: select PR fields based on detected features
This change is almost a revert to what had already done in #10984.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-07-01 11:14:50 +01: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
Daniel Krzeminski
b31f38c946
Fix: gh pr create prioritize --title and --body over --fill when --web is present (#10547)
* fix: prioritize title and body over autofill for prs

* fix: prioritize title and body over autofill tests

* refactor: collapse state conditions

---------

Co-authored-by: Babak K. Shandiz <babakks@github.com>
2025-06-24 12:54:43 +00:00
jinjingroad
28d5de9d8e chore: fix function name
Signed-off-by: jinjingroad <jinjingroad@sina.com>
2025-06-19 12:36:52 +08:00
William Martin
8baf5cc3e4
Merge pull request #11065 from cli/andyfeller/gh-pr-edit-assignees
Fix assignees being dropped from `gh pr edit`
2025-06-11 15:44:42 +02: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
Kynan Ware
ed4b90104f test(pr): Add tests for actor assignees 2025-06-03 14:30:19 +01:00
Andy Feller
a24d39ac87 Fix test, remove partial standalone test 2025-06-03 13:48:01 +01:00
Andy Feller
cde860be88 Iterate on pr edit problems with existing assignees
This commit is a handful of changes around `gh pr edit --add-assignee` behavior.  Most notably, fixing a bug where the assigned actors weren't being dropped.

In addition to this, I was refactoring the testing setup to allow for individual test table scenarios could be contained.
2025-06-03 13:33:52 +01:00
William Martin
c13f2f1232
Merge pull request #11057 from cli/wm/fix-pr-edit
Fix pr edit when URL is provided
2025-06-02 17:44:30 +02:00
Tim Rogers
9a8031151c
Document support for @copilot in gh [pr|issue] edit --add-assignee and --remove-assignee (#11056)
* Document support for `@copilot` in `gh [pr|issue] edit --add-assignee` and `--remove-assignee`

Following up on #10991, this updates the help text for
`issue edit` and `pr edit`'s `--add-assignee` and
`--remove-assignee` options to mention that you can use
`@copilot`.

This is already mentioned in the command-level help text, but
not at the argument level, whereas the `@me` macro is.

* Apply suggestion from @babakks

Co-authored-by: Babak K. Shandiz <babakks@github.com>

* Apply suggestion from @babakks

Co-authored-by: Babak K. Shandiz <babakks@github.com>

---------

Co-authored-by: Babak K. Shandiz <babakks@github.com>
2025-06-02 16:29:35 +01:00
William Martin
793a7ff459 Fix pr edit when URL is provided 2025-06-02 15:07:55 +02:00
Babak K. Shandiz
d1b82d19f9
Merge pull request #10980 from cli/babakks/improve-pr-create-docs
Mention `pr create` will print the created PR's URL
2025-05-28 16:43:04 +01:00
Babak K. Shandiz
c927ea40c3
Merge pull request #10979 from cli/babakks/improve-pr-list-docs
Add example usage of `--head` option to `pr list` docs
2025-05-28 14:38:17 +01:00
Babak K. Shandiz
aa64bb5708
docs(pr list): mention --head does not support <owner>:<branch> syntax
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-05-28 12:55:11 +01: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
d932934119 Merge branch 'trunk' into kw/gh-cli-epic-900-actors-are-assignable 2025-05-16 12:49:52 -06:00
Kynan Ware
a28e2d8784 refactor(api): use constant for Copilot login 2025-05-16 12:28:46 -06:00
Kynan Ware
3a8cdda148
Merge pull request #10991 from cli/kw/gh-cli-917-special-actor-assignee-names-noninteractive
`issue edit`, `pr edit`: Support special non-interactive (flags) assignee name `@copilot`
2025-05-16 12:19:43 -06:00
Kynan Ware
748afb6e85 doc(issue/pr edit): clarify @copilot usage 2025-05-16 12:18:23 -06:00
Kynan Ware
475163a126
Merge pull request #10990 from cli/kw/gh-cli-916-special-actor-assignee-names
`issue edit`, `pr edit`: handle display names in interactive assignee editing
2025-05-16 10:16:08 -06:00
Kynan Ware
532aa1c32a doc(issue/pr edit): doc @copilot assignee 2025-05-16 09:55:17 -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