ResolveIssueTypeName resolves an issue type name to its node ID by fetching the repository's available types.
(client *api.Client, repo ghrepo.Interface, typeName string)
| 232 | // ResolveIssueTypeName resolves an issue type name to its node ID by |
| 233 | // fetching the repository's available types. |
| 234 | func ResolveIssueTypeName(client *api.Client, repo ghrepo.Interface, typeName string) (string, error) { |
| 235 | issueTypes, err := api.RepoIssueTypes(client, repo) |
| 236 | if err != nil { |
| 237 | return "", err |
| 238 | } |
| 239 | |
| 240 | typeNames := make([]string, len(issueTypes)) |
| 241 | for i, t := range issueTypes { |
| 242 | typeNames[i] = t.Name |
| 243 | if strings.EqualFold(t.Name, typeName) { |
| 244 | return t.ID, nil |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | return "", fmt.Errorf("type %q not found; available types: %s", typeName, strings.Join(typeNames, ", ")) |
| 249 | } |
nothing calls this directly
no test coverage detected