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