Merge pull request #13025 from cli/kw/refactor/reviewer-assignee-actor-symmetry
Consolidate actor-mode signals into ApiActorsSupported
This commit is contained in:
commit
8f7d20855e
18 changed files with 178 additions and 121 deletions
|
|
@ -311,7 +311,7 @@ func IssueCreate(client *Client, repo *Repository, params map[string]interface{}
|
|||
}
|
||||
issue := &result.CreateIssue.Issue
|
||||
|
||||
// Assign users using login-based mutation when ActorAssignees is true (github.com).
|
||||
// Assign users using login-based mutation when ApiActorsSupported is true (github.com).
|
||||
if assigneeLogins, ok := params["assigneeLogins"].([]string); ok && len(assigneeLogins) > 0 {
|
||||
err := ReplaceActorsForAssignableByLogin(client, repo, issue.ID, assigneeLogins)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -524,7 +524,7 @@ func CreatePullRequest(client *Client, repo *Repository, params map[string]inter
|
|||
}
|
||||
}
|
||||
|
||||
// Assign users using login-based mutation when ActorAssignees is true (github.com).
|
||||
// Assign users using login-based mutation when ApiActorsSupported is true (github.com).
|
||||
if assigneeLogins, ok := params["assigneeLogins"].([]string); ok && len(assigneeLogins) > 0 {
|
||||
err := ReplaceActorsForAssignableByLogin(client, repo, pr.ID, assigneeLogins)
|
||||
if err != nil {
|
||||
|
|
@ -532,7 +532,7 @@ func CreatePullRequest(client *Client, repo *Repository, params map[string]inter
|
|||
}
|
||||
}
|
||||
|
||||
// TODO requestReviewsByLoginCleanup
|
||||
// TODO ApiActorsSupported
|
||||
// Request reviewers using either login-based (github.com) or ID-based (GHES) mutation.
|
||||
// The ID-based path can be removed once GHES supports requestReviewsByLogin.
|
||||
userLogins, hasUserLogins := params["userReviewerLogins"].([]string)
|
||||
|
|
@ -599,6 +599,12 @@ func ReplaceActorsForAssignableByLogin(client *Client, repo ghrepo.Interface, as
|
|||
|
||||
actorLogins := make([]githubv4.String, len(logins))
|
||||
for i, l := range logins {
|
||||
// The replaceActorsForAssignable mutation requires the [bot] suffix
|
||||
// for bot actor logins (e.g. "copilot-swe-agent[bot]"), unlike
|
||||
// requestReviewsByLogin which has a separate botLogins field.
|
||||
if l == CopilotAssigneeLogin {
|
||||
l = l + "[bot]"
|
||||
}
|
||||
actorLogins[i] = githubv4.String(l)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -963,14 +963,15 @@ func (m *RepoMetadataResult) Merge(m2 *RepoMetadataResult) {
|
|||
}
|
||||
|
||||
type RepoMetadataInput struct {
|
||||
Assignees bool
|
||||
ActorAssignees bool
|
||||
Reviewers bool
|
||||
TeamReviewers bool
|
||||
Labels bool
|
||||
ProjectsV1 bool
|
||||
ProjectsV2 bool
|
||||
Milestones bool
|
||||
Assignees bool
|
||||
Reviewers bool
|
||||
TeamReviewers bool
|
||||
// TODO ApiActorsSupported
|
||||
ApiActorsSupported bool
|
||||
Labels bool
|
||||
ProjectsV1 bool
|
||||
ProjectsV2 bool
|
||||
Milestones bool
|
||||
}
|
||||
|
||||
// RepoMetadata pre-fetches the metadata for attaching to issues and pull requests
|
||||
|
|
@ -979,7 +980,8 @@ func RepoMetadata(client *Client, repo ghrepo.Interface, input RepoMetadataInput
|
|||
var g errgroup.Group
|
||||
|
||||
if input.Assignees || input.Reviewers {
|
||||
if input.ActorAssignees {
|
||||
// TODO ApiActorsSupported
|
||||
if input.ApiActorsSupported {
|
||||
g.Go(func() error {
|
||||
actors, err := RepoAssignableActors(client, repo)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue