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)
| 592 | // ReplaceActorsForAssignableByLogin calls the replaceActorsForAssignable mutation |
| 593 | // using actor logins. This avoids the need to resolve logins to node IDs. |
| 594 | func ReplaceActorsForAssignableByLogin(client *Client, repo ghrepo.Interface, assignableID string, logins []string) error { |
| 595 | type ReplaceActorsForAssignableInput struct { |
| 596 | AssignableID githubv4.ID `json:"assignableId"` |
| 597 | ActorLogins []githubv4.String `json:"actorLogins"` |
| 598 | } |
| 599 | |
| 600 | actorLogins := make([]githubv4.String, len(logins)) |
| 601 | for i, l := range logins { |
| 602 | // The replaceActorsForAssignable mutation requires the [bot] suffix |
| 603 | // for bot actor logins (e.g. "copilot-swe-agent[bot]"), unlike |
| 604 | // requestReviewsByLogin which has a separate botLogins field. |
| 605 | if l == CopilotAssigneeLogin { |
| 606 | l = l + "[bot]" |
| 607 | } |
| 608 | actorLogins[i] = githubv4.String(l) |
| 609 | } |
| 610 | |
| 611 | var mutation struct { |
| 612 | ReplaceActorsForAssignable struct { |
| 613 | TypeName string `graphql:"__typename"` |
| 614 | } `graphql:"replaceActorsForAssignable(input: $input)"` |
| 615 | } |
| 616 | |
| 617 | variables := map[string]interface{}{ |
| 618 | "input": ReplaceActorsForAssignableInput{ |
| 619 | AssignableID: githubv4.ID(assignableID), |
| 620 | ActorLogins: actorLogins, |
| 621 | }, |
| 622 | } |
| 623 | |
| 624 | return client.Mutate(repo.RepoHost(), "ReplaceActorsForAssignable", &mutation, variables) |
| 625 | } |
| 626 | |
| 627 | // SuggestedAssignableActors fetches up to 10 suggested actors for a specific assignable |
| 628 | // (Issue or PullRequest) node ID. `assignableID` is the GraphQL node ID for the Issue/PR. |
no test coverage detected