Skip to content

Conversation

@BagToad
Copy link
Member

@BagToad BagToad commented May 10, 2025

Description

This introduces support for handling "Actor" assignees (e.g., bots) in addition to user assignees for issues. The changes include updates to feature detection, GraphQL queries, and associated tests to accommodate this new functionality.

These changes cover both interactive and non-interactive (flags) flows.

Note

This intentionally does not merge into trunk, as part of a stacked PR workflow.

Acceptance Criteria

Given I have an issue where an Actor is assignable and
Given I am authenticated with a GitHub host that supports the Actor type.
When I run gh issue edit <issuenum> and select to edit Assignees
Then I receive a list of assignees that includes assignable Actors, and the Actors already assigned to the issue are pre-selected.
When I select one or more Actors from the list, and proceed
Then I see those selected Actors assigned to the issue

❯ gh issue edit 1 
? What would you like to edit? Assignees
? Assignees  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
> [ ]  ActorToad
  [x]  BagToad

# Note: showing the above was pre-selected ☝️ before selecting ActorToad

? Assignees  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
> [x]  ActorToad
  [x]  BagToad

? Submit? Yes
https://github.com/BagToad/reponame/issues/1

❯ gh issue view 1
some title#1
Open • BagToad opened about 15 days ago • 0 comments
Assignees: BagToad, ActorToad

Given I have an issue where an Actor is assignable and
Given I am authenticated with a GitHub host that supports the Actor type.
When I run gh issue edit <issuenum> --add-assignee <actorname>...
Then I see the specified Actor(s) are assigned to the issue

Given I have an issue where an Actor is assigned already
Given I am authenticated with a GitHub host that supports the Actor type.
When I run gh issue edit <issuenum> --remove-assignee <actorname>...
Then I see the specified Actor(s) are unassigned from the issue

❯ gh issue edit 1 --add-assignee ActorToad
https://github.com/BagToad/reponame/issues/1

❯ gh issue view 1
some title#1
Open • BagToad opened about 15 days ago • 0 comments
Assignees: BagToad, ActorToad

❯ gh issue edit 1 --remove-assignee ActorToad
https://github.com/BagToad/reponame/issues/1

❯ gh issue view 1
some title#1
Open • BagToad opened about 15 days ago • 0 comments
Assignees: BagToad

@BagToad BagToad temporarily deployed to cli-automation May 10, 2025 05:26 — with GitHub Actions Inactive
@BagToad BagToad marked this pull request as ready for review May 10, 2025 05:31
@BagToad BagToad requested a review from a team as a code owner May 10, 2025 05:31
@BagToad BagToad requested review from williammartin and removed request for a team May 10, 2025 05:31
@BagToad BagToad temporarily deployed to cli-automation May 10, 2025 05:31 — with GitHub Actions Inactive
@BagToad BagToad requested review from andyfeller and Copilot May 10, 2025 05:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Support for assigning “Actor” types (e.g., bots) to issues by extending models, feature detection, GraphQL queries, and tests.

  • Introduce EditableAssignees to distinguish actor vs. user assignees in interactive and flags flows
  • Add RepoAssignableActors and update RepoMetadataInput/Result to fetch and merge actor assignees
  • Update editRun logic, API mutations, and tests to handle the new assignedActors field

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/cmd/pr/shared/editable_http.go Added replaceActorAssigneesForEditable mutation
pkg/cmd/pr/shared/editable.go Introduced EditableAssignees and updated FetchOptions
pkg/cmd/pr/edit/edit_test.go Switched tests to use EditableAssignees
pkg/cmd/issue/edit/edit_test.go Updated issue edit tests and added TestActorIsAssignable
pkg/cmd/issue/edit/edit.go Detect ActorIsAssignable and append assignedActors field
internal/featuredetection/feature_detection.go Added ActorIsAssignable flag in IssueFeatures
api/queries_repo.go Implemented RepoAssignableActors and extended RepoMetadata
api/queries_issue.go Added ActorAssignees type and AssignedActors mapping
Comments suppressed due to low confidence (1)

api/queries_repo.go:1237

  • Add unit tests for RepoAssignableActors covering cases where suggestedActors includes Bot entries, to ensure both User and Bot nodes are returned correctly.
func RepoAssignableActors(client *Client, repo ghrepo.Interface) ([]RepoAssignee, error) {

BagToad added 2 commits May 12, 2025 11:34
This improves actor type handling while fetching repository assignable actors.
@BagToad BagToad changed the title gh issue actors are assignable to issues gh issue: actors are assignable to issues May 12, 2025
@andyfeller andyfeller added the discuss Feature changes that require discussion primarily among the GitHub CLI team label May 12, 2025
@andyfeller andyfeller temporarily deployed to cli-discuss-automation May 12, 2025 18:29 — with GitHub Actions Inactive
Copy link
Member

@andyfeller andyfeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for a partial review as I get caught up to speed on the implications of actors versus assignees; will review the rest of the PR tomorrow 🙇

@BagToad BagToad requested a review from andyfeller May 13, 2025 14:15
@BagToad BagToad requested a review from williammartin May 13, 2025 14:15
Copy link
Member

@williammartin williammartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given I have an issue where an Actor is assignable and
Given I am authenticated with a GitHub host that supports the Actor type.
When I run gh issue edit <issuenum> and select to edit Assignees
Then I receive a list of assignees that includes assignable Actors, and the Actors already assigned to the issue are pre-selected.
When I select one or more Actors from the list, and proceed
Then I see those selected Actors assigned to the issue

@BagToad, have you tried editing an issue where an Actor is already assigned and seeing that it is still assigned in the prompter? I think this doesn't work both from reading the code and trying it out.

Specifically, I'm calling out this line:

Then I receive a list of assignees that includes assignable Actors, and the Actors already assigned to the issue are pre-selected.

Relevant code that probably shouldn't be using assignableUsers:

for _, u := range metadataResult.AssignableUsers {
assignees = append(assignees, u.DisplayName())
}

@BagToad
Copy link
Member Author

BagToad commented May 14, 2025

@BagToad, have you tried editing an issue where an Actor is already assigned and seeing that it is still assigned in the prompter? I think this doesn't work both from reading the code and trying it out.

@williammartin This should work, and does in my tests.

The code where this happens is here, as far as I understand:

if editable.Assignees.ActorAssignees {
editable.Assignees.Default = issue.AssignedActors.Logins()
} else {
editable.Assignees.Default = issue.Assignees.Logins()
}

@williammartin
Copy link
Member

Confirming that what I saw in #10960 (review) was the result of a branch that had regressed but is now fixed.

@BagToad BagToad changed the title gh issue: actors are assignable to issues gh issue edit: actors are assignable to issues May 14, 2025
Copy link
Member

@andyfeller andyfeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, I really appreciate the effort to align the actor work around new types as this looks much easier to manage and understand! ✨

I don't see anything that would really block this from continuing these efforts beyond various questions and nits.

I do wonder about the sealed types and the complications that raises with testing, though. Again, it isn't enough to block this going into the feature branch.

Comment on lines +1129 to +1133
user := struct {
Id string
Login string
Name string
}{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@williammartin : what are your thoughts of working around the sealed interface, preventing us from leveraging one of the declared types for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good question. Gut feeling is that I don't have a problem with it. If it mattered a lot we could implement https://pkg.go.dev/encoding/json#Unmarshaler on AssignableUser.

BagToad and others added 3 commits May 15, 2025 08:33
Co-authored-by: Andy Feller <andyfeller@github.com>
Co-authored-by: Andy Feller <andyfeller@github.com>
@BagToad BagToad merged commit 999ffbd into kw/gh-cli-epic-900-actors-are-assignable May 15, 2025
14 checks passed
@BagToad BagToad deleted the kw/gh-cli-901-910-assign-actors-to-issues branch May 15, 2025 15:24
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request May 20, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cli/cli](https://github.com/cli/cli) | minor | `v2.72.0` -> `v2.73.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>cli/cli (cli/cli)</summary>

### [`v2.73.0`](https://github.com/cli/cli/releases/tag/v2.73.0): GitHub CLI 2.73.0

[Compare Source](cli/cli@v2.72.0...v2.73.0)

#### :copilot: Copilot Coding Agent Support

You can now assign issues to GitHub Copilot directly from `gh`, just as you would assign them to a teammate. Use `gh issue edit <number> --add-assignee @&#8203;copilot` to assign the GitHub Copilot coding agent, and Copilot will work in the background to understand the issue, propose a solution, and open a pull request when it's ready for your review. If you run `gh issue edit` interactively, `Copilot (AI)` will be displayed as a potential assignee. This feature is available for GitHub Copilot Pro+ and Copilot Enterprise subscribers. For more details, refer to [the full changelog post for Copilot coding agent](https://github.blog/changelog/2025-05-19-github-copilot-coding-agent-in-public-preview/).

#### What's Changed

##### ✨ Features

-   Copilot is assignable to issues and pull requests with `issue edit` and `pr edit` by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#10992
    -   `gh issue edit`: actors are assignable to issues by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#10960
    -   `gh pr edit`: Assign actors to pull requests by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#10984
    -   `issue edit`, `pr edit`: handle display names in interactive assignee editing   by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#10990
    -   `issue edit`, `pr edit`: Support special non-interactive (flags) assignee name `@copilot` by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#10991
-   \[gh issue/pr comment] Add support for last comment delete for issues and MRs by [@&#8203;sinansonmez](https://github.com/sinansonmez) in cli/cli#10596
-   \[gh issue view] Expose `closedByPullRequestsReferences` JSON field by [@&#8203;iamazeem](https://github.com/iamazeem) in cli/cli#10941
-   Accessible prompter always displays selection defaults in a format readable by a screen reader by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#10937

##### 🐛 Fixes

-   Fix `StatusJSONResponse` usage by [@&#8203;babakks](https://github.com/babakks) in cli/cli#10810
-   Fix panic on `gh pr view 0` by [@&#8203;nopcoder](https://github.com/nopcoder) in cli/cli#10729
-   Fix flakey test for accessible prompter by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#10918
-   Fix accessible prompter flaky tests by [@&#8203;babakks](https://github.com/babakks) in cli/cli#10977
-   Handle missing archive URLs on release download by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#10947
-   Fix bug when removing all MR reviewers by [@&#8203;babakks](https://github.com/babakks) in cli/cli#10975

##### 📚 Docs & Chores

-   Feature detect v1 projects on pr view by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#10821
-   Feature detect v1 projects on non-interactive pr create by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#10909
-   Feature detect v1 projects on web mode pr create by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#10911
-   Feature detect v1 projects on interactive `pr create` by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#10915
-   Feature detect v1 projects on pr edit by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#10942
-   Move predicate type filtering in `gh attestation verify` by [@&#8203;malancas](https://github.com/malancas) in cli/cli#10670
-   Improve assertion for disabled echo mode by [@&#8203;babakks](https://github.com/babakks) in cli/cli#10927

##### :dependabot: Dependencies

-   chore(deps): bump actions/attest-build-provenance from 2.2.2 to 2.3.0 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#10886
-   chore(deps): bump github.com/cpuguy83/go-md2man/v2 from 2.0.6 to 2.0.7 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#10869

#### What's Changed

#### New Contributors

-   [@&#8203;sinansonmez](https://github.com/sinansonmez) made their first contribution in cli/cli#10596
-   [@&#8203;nopcoder](https://github.com/nopcoder) made their first contribution in cli/cli#10729

**Full Changelog**: cli/cli@v2.72.0...v2.73.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4xNS4wIiwidXBkYXRlZEluVmVyIjoiNDAuMTUuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discuss Feature changes that require discussion primarily among the GitHub CLI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants