ReplaceActorsForAssignableByLogin calls the replaceActorsForAssignable mutation using actor logins. This avoids the need to resolve logins to node IDs.
(client *Client, repo ghrepo.Interface, assignableID string, logins []string)
| 617 | // ReplaceActorsForAssignableByLogin calls the replaceActorsForAssignable mutation |
| 618 | // using actor logins. This avoids the need to resolve logins to node IDs. |
| 619 | func ReplaceActorsForAssignableByLogin(client *Client, repo ghrepo.Interface, assignableID string, logins []string) error { |
| 620 | type ReplaceActorsForAssignableInput struct { |
| 621 | AssignableID githubv4.ID `json:"assignableId"` |
| 622 | ActorLogins []githubv4.String `json:"actorLogins"` |
| 623 | } |
| 624 | |
| 625 | actorLogins := make([]githubv4.String, len(logins)) |
| 626 | for i, l := range logins { |
| 627 | // The replaceActorsForAssignable mutation requires the [bot] suffix |
| 628 | // for bot actor logins (e.g. "copilot-swe-agent[bot]"), unlike |
| 629 | // requestReviewsByLogin which has a separate botLogins field. |
| 630 | if l == CopilotAssigneeLogin { |
| 631 | l = l + "[bot]" |
| 632 | } |
| 633 | actorLogins[i] = githubv4.String(l) |
| 634 | } |
| 635 | |
| 636 | var mutation struct { |
| 637 | ReplaceActorsForAssignable struct { |
| 638 | TypeName string `graphql:"__typename"` |
| 639 | } `graphql:"replaceActorsForAssignable(input: $input)"` |
| 640 | } |
| 641 | |
| 642 | variables := map[string]any{ |
| 643 | "input": ReplaceActorsForAssignableInput{ |
| 644 | AssignableID: githubv4.ID(assignableID), |
| 645 | ActorLogins: actorLogins, |
| 646 | }, |
| 647 | } |
| 648 | |
| 649 | return client.Mutate(repo.RepoHost(), "ReplaceActorsForAssignable", &mutation, variables) |
| 650 | } |
| 651 | |
| 652 | // SuggestedAssignableActors fetches up to 10 suggested actors for a specific assignable |
| 653 | // (Issue or PullRequest) node ID. `assignableID` is the GraphQL node ID for the Issue/PR. |
no test coverage detected