MCPcopy Create free account
hub / github.com/cli/cli / AssigneeLogins

Method AssigneeLogins

pkg/cmd/pr/shared/editable.go:156–183  ·  view source on GitHub ↗

AssigneeLogins computes the final list of assignee logins from the current defaults plus any Add/Remove operations. Unlike AssigneeIds, this does not resolve logins to node IDs, and is used on github.com where the ReplaceActorsForAssignable mutation accepts logins directly.

(client *api.Client, repo ghrepo.Interface)

Source from the content-addressed store, hash-verified

154// resolve logins to node IDs, and is used on github.com where the
155// ReplaceActorsForAssignable mutation accepts logins directly.
156func (e Editable) AssigneeLogins(client *api.Client, repo ghrepo.Interface) ([]string, error) {
157 if !e.Assignees.Edited {
158 return nil, nil
159 }
160
161 if len(e.Assignees.Add) != 0 || len(e.Assignees.Remove) != 0 {
162 replacer := NewSpecialAssigneeReplacer(client, repo.RepoHost(), true, true)
163
164 assigneeSet := set.NewStringSet()
165 assigneeSet.AddValues(e.Assignees.DefaultLogins)
166
167 add, err := replacer.ReplaceSlice(e.Assignees.Add)
168 if err != nil {
169 return nil, err
170 }
171 assigneeSet.AddValues(add)
172
173 remove, err := replacer.ReplaceSlice(e.Assignees.Remove)
174 if err != nil {
175 return nil, err
176 }
177 assigneeSet.RemoveValues(remove)
178
179 e.Assignees.Value = assigneeSet.ToSlice()
180 }
181
182 return e.Assignees.Value, nil
183}
184
185// SpecialAssigneeReplacer expands special assignee names (@me, Copilot actors)
186// in login slices. Use NewSpecialAssigneeReplacer to create one.

Callers 1

UpdateIssueFunction · 0.80

Calls 7

ReplaceSliceMethod · 0.95
NewStringSetFunction · 0.92
AddValuesMethod · 0.80
RemoveValuesMethod · 0.80
RepoHostMethod · 0.65
ToSliceMethod · 0.65

Tested by

no test coverage detected