MCPcopy Create free account
hub / github.com/github/awesome-copilot / parseRepoFromRemoteUrl

Function parseRepoFromRemoteUrl

eng/contributor-report.mjs:299–313  ·  view source on GitHub ↗
(remoteUrl)

Source from the content-addressed store, hash-verified

297 */
298const 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', {

Callers 1

getGitHubRepoFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected