parseRepositoryURL extracts the owner and repo from a GitHub API repository URL of the form https://api.github.com/repos/{owner}/{repo}.
(repoURL string)
| 1655 | // parseRepositoryURL extracts the owner and repo from a GitHub API repository |
| 1656 | // URL of the form https://api.github.com/repos/{owner}/{repo}. |
| 1657 | func parseRepositoryURL(repoURL string) (string, string, bool) { |
| 1658 | if repoURL == "" { |
| 1659 | return "", "", false |
| 1660 | } |
| 1661 | const marker = "/repos/" |
| 1662 | idx := strings.LastIndex(repoURL, marker) |
| 1663 | if idx < 0 { |
| 1664 | return "", "", false |
| 1665 | } |
| 1666 | parts := strings.Split(strings.Trim(repoURL[idx+len(marker):], "/"), "/") |
| 1667 | if len(parts) < 2 || parts[0] == "" || parts[1] == "" { |
| 1668 | return "", "", false |
| 1669 | } |
| 1670 | return parts[0], parts[1], true |
| 1671 | } |
| 1672 | |
| 1673 | // SearchIssueResult wraps a REST search hit with its custom issue field values, fetched in a follow-up GraphQL nodes() query. |
| 1674 | type SearchIssueResult struct { |
no outgoing calls
no test coverage detected