| 297 | */ |
| 298 | const getGitHubRepo = () => { |
| 299 | const parseRepoFromRemoteUrl = (remoteUrl) => { |
| 300 | const url = String(remoteUrl || '').trim(); |
| 301 | if (!url) return null; |
| 302 | |
| 303 | // Supports: |
| 304 | // - git@github.com:owner/repo.git |
| 305 | // - ssh://git@github.com/owner/repo.git |
| 306 | // - https://github.com/owner/repo.git |
| 307 | // - https://github.com/owner/repo |
| 308 | const regex = /github\.com[/:]([^/]+)\/([^/?#]+?)(?:\.git)?(?:[/?#]|$)/; |
| 309 | const match = regex.exec(url); |
| 310 | if (!match) return null; |
| 311 | |
| 312 | return `${match[1]}/${match[2]}`; |
| 313 | }; |
| 314 | |
| 315 | try { |
| 316 | const upstreamUrl = execSync('git config --get remote.upstream.url', { |