(originUrl: string | null)
| 11 | * ssh://git@github.com/owner/repo(.git). |
| 12 | */ |
| 13 | export function parseGitHubRepo(originUrl: string | null): GitHubRepo | null { |
| 14 | if (!originUrl) return null; |
| 15 | const match = originUrl.match(/(?:^|@|\/\/)github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/); |
| 16 | if (!match) return null; |
| 17 | const [, owner, repo] = match; |
| 18 | if (!owner || !repo) return null; |
| 19 | return { owner, repo }; |
| 20 | } |
| 21 | |
| 22 | export function isGitHubRemote(originUrl: string | null): boolean { |
| 23 | return parseGitHubRepo(originUrl) !== null; |
no outgoing calls
no test coverage detected