Two bugs introduced in #13009 found during acceptance testing:
1. `pr create --assignee @copilot` sent the literal `@copilot` to the
API because NewIssueState only ran MeReplacer on assignees, not
CopilotReplacer. Fixed by switching to SpecialAssigneeReplacer (which
handles both @me and @copilot) like issue create already does.
2. The replaceActorsForAssignable mutation requires the [bot] suffix on
bot actor logins (e.g. `copilot-swe-agent[bot]`), unlike
requestReviewsByLogin which has a separate botLogins field. Added the
suffix in ReplaceActorsForAssignableByLogin for CopilotAssigneeLogin.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Aligns the feature detector field name with the downstream
ApiActorsSupported flag introduced in the previous commit, so the
signal has one consistent name from detection through to consumption.
Also consolidates leftover TODO tags (actorIsAssignableCleanup,
requestReviewsByLoginCleanup) under the single // TODO ApiActorsSupported
tag so there's exactly one thing to grep for.
Pure rename with no logic changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CLI had two per-entity flags (ActorAssignees on EditableAssignees and
IssueMetadataState, ActorReviewers on IssueMetadataState) threaded through
different layers of the stack to distinguish github.com from GHES. Both
flags were always set from the same source (issueFeatures.ActorIsAssignable)
and never had different values, but they were carried independently on
different structs. This led to a confusing asymmetry where:
- EditableAssignees had ActorAssignees but EditableReviewers had nothing
- The PR edit flow piggybacked on editable.Assignees.ActorAssignees to
make reviewer mutation decisions, which was misleading
- RepoMetadataInput only had ActorAssignees with no reviewer equivalent
This commit replaces all per-entity flags with a single ApiActorsSupported
bool hoisted to the shared level on Editable, IssueMetadataState, and
RepoMetadataInput. Both assignees and reviewers now key off the same signal.
Every branch site is marked with // TODO ApiActorsSupported so we can grep
for cleanup sites when GHES eventually supports the actor-based mutations
(replaceActorsForAssignable, requestReviewsByLogin).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wire up MultiSelectWithSearch for assignees in MetadataSurvey, replacing
the static MultiSelect that required bulk fetching all assignable actors.
This applies to both gh pr create and gh issue create interactive flows
when selecting assignees via the 'Add metadata' prompt.
Changes:
- Add assigneeSearchFunc parameter to MetadataSurvey
- Skip assignee bulk fetch when search func is available
- New SearchRepoAssignableActors API function for repo-level search
(create flows have no issue/PR node ID yet)
- New RepoAssigneeSearchFunc in shared editable.go
- Refactor actorsToSearchResult helper shared by both search functions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When ActorAssignees is true (github.com), pass assignee logins directly
to the ReplaceActorsForAssignable mutation instead of resolving logins
to node IDs. This eliminates the need to bulk fetch all assignable
users/actors and fixes a bug where providing assignees via CLI flag
and then interactively adding metadata would fail with 'not found'
because the cached MetadataResult had no assignee data.
Changes:
- Set state.ActorAssignees = true in pr create (was missing)
- AddMetadataToIssueParams: pass assigneeLogins when ActorAssignees
is true, skip fetch and ID resolution entirely
- CreatePullRequest/IssueCreate: call ReplaceActorsForAssignableByLogin
after creation to assign via logins
- Consolidate replaceActorsForAssignable mutation into api/ package
(ReplaceActorsForAssignableByLogin + ReplaceActorsForAssignableByID)
- Remove duplicate replaceActorAssigneesForEditable from editable_http.go
- Add TODO replaceActorsByLoginCleanup markers on edit paths
Fixescli/cli#13000
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wire CopilotReviewerReplacer into NewIssueState so that
`gh pr create --reviewer @copilot` correctly resolves to the
copilot-pull-request-reviewer bot login, matching the behavior
already implemented in gh pr edit.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>
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.
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.
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.
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.
* 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>
As far as I can see, when there is project metadata, the preview option
will never be shown in the interactive multiselect, so I don't believe
this change has any functional difference. However, I did use the
opportunity to drive out tests for generateCompareURL