Repository: cli/cli
File: api/queries_repo.go (Go)

Code before:
	if len(m2.Milestones) > 0 || len(m.Milestones) == 0 {
		m.Milestones = m2.Milestones
	}
}

type RepoMetadataInput struct {
	Assignees      bool
	ActorAssignees bool
	Reviewers      bool
	Labels         bool
	ProjectsV1     bool
	ProjectsV2     bool
	Milestones     bool
}

// RepoMetadata pre-fetches the metadata for attaching to issues and pull requests
func RepoMetadata(client *Client, repo ghrepo.Interface, input RepoMetadataInput) (*RepoMetadataResult, error) {
	var result RepoMetadataResult
	var g errgroup.Group

	if input.Assignees || input.Reviewers {
		if input.ActorAssignees {
			g.Go(func() error {
				actors, err := RepoAssignableActors(client, repo)
				if err != nil {
					return fmt.Errorf("error fetching assignees: %w", err)
				}
				result.AssignableActors = actors

				// Processing the bots out from the actors
				// because requesting a reviewer leverages
				// result.AssignableUsers.
				// Note: this prevents us from needing to make another
				// request to fetch assignable users when the user has
				// selected to modify both reviewers and assignees.
				var users []AssignableUser
				for _, a := range actors {
					if _, ok := a.(AssignableUser); !ok {
						continue
					}
					users = append(users, a.(AssignableUser))
				}
				result.AssignableUsers = users
				return nil
			})
		} else {
			// Not using Actors, fetch legacy assignable users.
			g.Go(func() error {
				users, err := RepoAssignableUsers(client, repo)
				if err != nil {
					err = fmt.Errorf("error fetching assignees: %w", err)

Review comment (suggestion):
**nit:** I would appreciate being able to distinguish this error from the similarly described error below when we retrieve assignees

```suggestion
					return fmt.Errorf("error fetching actors: %w", err)
```

Code after:
	if len(m2.Milestones) > 0 || len(m.Milestones) == 0 {
		m.Milestones = m2.Milestones
	}
}

type RepoMetadataInput struct {
	Assignees      bool
	ActorAssignees bool
	Reviewers      bool
	Labels         bool
	ProjectsV1     bool
	ProjectsV2     bool
	Milestones     bool
}

// RepoMetadata pre-fetches the metadata for attaching to issues and pull requests
func RepoMetadata(client *Client, repo ghrepo.Interface, input RepoMetadataInput) (*RepoMetadataResult, error) {
	var result RepoMetadataResult
	var g errgroup.Group

	if input.Assignees || input.Reviewers {
		if input.ActorAssignees {
			g.Go(func() error {
				actors, err := RepoAssignableActors(client, repo)
				if err != nil {
					return fmt.Errorf("error fetching assignable actors: %w", err)
				}
				result.AssignableActors = actors

				// Filter actors for users to use for pull request reviewers,
				// skip retrieving the same info through RepoAssignableUsers().
				var users []AssignableUser
				for _, a := range actors {
					if _, ok := a.(AssignableUser); !ok {
						continue
					}
					users = append(users, a.(AssignableUser))
				}
				result.AssignableUsers = users
				return nil
			})
		} else {
			// Not using Actors, fetch legacy assignable users.
			g.Go(func() error {
				users, err := RepoAssignableUsers(client, repo)
				if err != nil {
					err = fmt.Errorf("error fetching assignable users: %w", err)
				}
				result.AssignableUsers = users
				return err
			})