ResolveIssueRef parses an issue reference (number or URL) and returns its node ID. References that point at a different host than baseRepo are rejected because relationship mutations require IDs from the base host.
(client *api.Client, baseRepo ghrepo.Interface, ref string)
| 213 | // node ID. References that point at a different host than baseRepo are |
| 214 | // rejected because relationship mutations require IDs from the base host. |
| 215 | func ResolveIssueRef(client *api.Client, baseRepo ghrepo.Interface, ref string) (string, error) { |
| 216 | number, repo, err := ParseIssueFromArg(ref) |
| 217 | if err != nil { |
| 218 | return "", err |
| 219 | } |
| 220 | |
| 221 | targetRepo := baseRepo |
| 222 | if r, ok := repo.Value(); ok { |
| 223 | if r.RepoHost() != baseRepo.RepoHost() { |
| 224 | return "", fmt.Errorf("issue reference %q belongs to a different host (%s) than the current repository (%s)", ref, r.RepoHost(), baseRepo.RepoHost()) |
| 225 | } |
| 226 | targetRepo = r |
| 227 | } |
| 228 | |
| 229 | return api.IssueNodeID(client, targetRepo, number) |
| 230 | } |
| 231 | |
| 232 | // ResolveIssueTypeName resolves an issue type name to its node ID by |
| 233 | // fetching the repository's available types. |
nothing calls this directly
no test coverage detected