-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Copilot is assignable to issues and pull requests with issue edit and pr edit
#10992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This improves actor type handling while fetching repository assignable actors.
- 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.
Co-authored-by: Andy Feller <andyfeller@github.com>
Co-authored-by: Andy Feller <andyfeller@github.com>
…-issues `gh issue edit`: actors are assignable to issues
Co-authored-by: Andy Feller <andyfeller@github.com>
…i-909-911-assign-actors-to-prs
…-prs `gh pr edit`: Assign actors to pull requests
- Added tests for handling nil and empty slices in the Copilot replacer. - Simplified test structure by removing unnecessary wantErr field.
…ee-names `issue edit`, `pr edit`: handle display names in interactive assignee editing
…ee-names-noninteractive `issue edit`, `pr edit`: Support special non-interactive (flags) assignee name `@copilot`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for assignable actors (e.g., bots) alongside legacy user assignees in both issue and PR edit flows, updating data models, API queries, and interactive behavior.
- Introduce
AssignableActor,AssignableUser, andAssignableBottypes and extendRepoMetadataResultto includeAssignableActors. - Update edit logic to detect host support for actor assignees and switch between
assigneesandassignedActorsfields. - Add a special
CopilotReplacerand related tests to handle the@copilotplaceholder.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cmd/pr/shared/editable.go | Extend Editable to track actor vs. user assignees |
| pkg/cmd/pr/shared/editable_http.go | Separate actor‐based assignment mutation call |
| pkg/cmd/pr/shared/survey.go | Switch to method calls for AssignableUser API |
| pkg/cmd/pr/shared/params.go | Add CopilotReplacer; update slice‐replacement logic |
| api/queries_repo.go | Add AssignableActor fetching and merge logic |
| api/query_builder.go | Define assignedActors GraphQL snippet |
| api/queries_pr.go & api/queries_issue.go | Include AssignedActors in PR/Issue types |
| internal/featuredetection/feature_detection.go | Add ActorIsAssignable feature flag |
| Various test files | Adjust tests for actor‐assignee flows and Copilot |
| } | ||
|
|
||
| var assignedActors = shortenQuery(` | ||
| assignedActors(first: 10) { |
Copilot
AI
May 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignedActors query fetches only the first 10 actors (first: 10), whereas other list queries use larger limits (e.g., 100). Consider increasing to first: 100 to avoid missing actors in repositories with many bots/users.
| assignedActors(first: 10) { | |
| assignedActors(first: 100) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rejecting change because this is intentional (only 10 actors can be assigned).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: I'm honestly not opposed to Copilot suggestion as it wouldn't hurt to retrieve whatever information is available even though we know currently only 10 can be assigned.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
andyfeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I think the stacked PRs helped work through this PR much easier! 💯
I had a handful of questions and an odd suggestion but nothing end of the world.
| } | ||
|
|
||
| var assignedActors = shortenQuery(` | ||
| assignedActors(first: 10) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: I'm honestly not opposed to Copilot suggestion as it wouldn't hurt to retrieve whatever information is available even though we know currently only 10 can be assigned.
| case "assignedActors": | ||
| q = append(q, assignedActors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: one of the things I'm doing in this final PR is comparing the changes in certain files to see if there are any missing test changes.
one thing I noticed in query_builder_test.go were tests around this function:
Lines 51 to 90 in 53d0d5d
| func TestIssueGraphQL(t *testing.T) { | |
| tests := []struct { | |
| name string | |
| fields []string | |
| want string | |
| }{ | |
| { | |
| name: "empty", | |
| fields: []string(nil), | |
| want: "", | |
| }, | |
| { | |
| name: "simple fields", | |
| fields: []string{"number", "title"}, | |
| want: "number,title", | |
| }, | |
| { | |
| name: "fields with nested structures", | |
| fields: []string{"author", "assignees"}, | |
| want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name},totalCount}", | |
| }, | |
| { | |
| name: "compressed query", | |
| fields: []string{"files"}, | |
| want: "files(first: 100) {nodes {additions,deletions,path}}", | |
| }, | |
| { | |
| name: "projectItems", | |
| fields: []string{"projectItems"}, | |
| want: `projectItems(first:100){nodes{id, project{id,title}, status:fieldValueByName(name: "Status") { ... on ProjectV2ItemFieldSingleSelectValue{optionId,name}}},totalCount}`, | |
| }, | |
| } | |
| for _, tt := range tests { | |
| t.Run(tt.name, func(t *testing.T) { | |
| if got := IssueGraphQL(tt.fields); got != tt.want { | |
| t.Errorf("IssueGraphQL() = %v, want %v", got, tt.want) | |
| } | |
| }) | |
| } | |
| } |
I'm trying to think through when and why this is updated 🤔
issue edit, pr edit: Actors are assignableissue edit, pr edit: Actors are assignable
andyfeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
issue edit, pr edit: Actors are assignableissue edit and pr edit
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 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 @​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 [@​BagToad](https://github.com/BagToad) in cli/cli#10992 - `gh issue edit`: actors are assignable to issues by [@​BagToad](https://github.com/BagToad) in cli/cli#10960 - `gh pr edit`: Assign actors to pull requests by [@​BagToad](https://github.com/BagToad) in cli/cli#10984 - `issue edit`, `pr edit`: handle display names in interactive assignee editing by [@​BagToad](https://github.com/BagToad) in cli/cli#10990 - `issue edit`, `pr edit`: Support special non-interactive (flags) assignee name `@copilot` by [@​BagToad](https://github.com/BagToad) in cli/cli#10991 - \[gh issue/pr comment] Add support for last comment delete for issues and MRs by [@​sinansonmez](https://github.com/sinansonmez) in cli/cli#10596 - \[gh issue view] Expose `closedByPullRequestsReferences` JSON field by [@​iamazeem](https://github.com/iamazeem) in cli/cli#10941 - Accessible prompter always displays selection defaults in a format readable by a screen reader by [@​BagToad](https://github.com/BagToad) in cli/cli#10937 ##### 🐛 Fixes - Fix `StatusJSONResponse` usage by [@​babakks](https://github.com/babakks) in cli/cli#10810 - Fix panic on `gh pr view 0` by [@​nopcoder](https://github.com/nopcoder) in cli/cli#10729 - Fix flakey test for accessible prompter by [@​BagToad](https://github.com/BagToad) in cli/cli#10918 - Fix accessible prompter flaky tests by [@​babakks](https://github.com/babakks) in cli/cli#10977 - Handle missing archive URLs on release download by [@​williammartin](https://github.com/williammartin) in cli/cli#10947 - Fix bug when removing all MR reviewers by [@​babakks](https://github.com/babakks) in cli/cli#10975 ##### 📚 Docs & Chores - Feature detect v1 projects on pr view by [@​williammartin](https://github.com/williammartin) in cli/cli#10821 - Feature detect v1 projects on non-interactive pr create by [@​williammartin](https://github.com/williammartin) in cli/cli#10909 - Feature detect v1 projects on web mode pr create by [@​williammartin](https://github.com/williammartin) in cli/cli#10911 - Feature detect v1 projects on interactive `pr create` by [@​williammartin](https://github.com/williammartin) in cli/cli#10915 - Feature detect v1 projects on pr edit by [@​williammartin](https://github.com/williammartin) in cli/cli#10942 - Move predicate type filtering in `gh attestation verify` by [@​malancas](https://github.com/malancas) in cli/cli#10670 - Improve assertion for disabled echo mode by [@​babakks](https://github.com/babakks) in cli/cli#10927 #####
Dependencies - chore(deps): bump actions/attest-build-provenance from 2.2.2 to 2.3.0 by [@​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 [@​dependabot](https://github.com/dependabot) in cli/cli#10869 #### What's Changed #### New Contributors - [@​sinansonmez](https://github.com/sinansonmez) made their first contribution in cli/cli#10596 - [@​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-->
This pull request introduces support for handling "assignable actors" (users and bots). The changes include new data structures, methods, and feature detection logic to accommodate this functionality.
Built from:
gh issue edit: actors are assignable to issues #10960gh pr edit: Assign actors to pull requests #10984issue edit,pr edit: handle display names in interactive assignee editing #10990issue edit,pr edit: Support special non-interactive (flags) assignee name@copilot#10991