INNER CODE UNIT · TypeScript
githubUrlRegex
KinsonDigital/Velaptor · DevTools/create-pr.ts:69
const githubUrlRegex = /https:\/\/github\.com\/(.+\/)(.+)\.git/;
if (!githubUrlRegex.test(url)) {
printIndianRed("The remote 'origin' URL is not a valid GitHub URL.");
Deno.exit(1);
}
printGray("Getting GitHub repository owner and name");
url = url.replace("https://github.com/", "").replace(".git", "");
const urlSections = url.split("/");
[repoOwnerName, repoName] = urlSections;
printGray(`Repository owner ${repoOwnerName}`);
printGray(`Repository name ${repoName}`);
} catch (error) {
const errMsg = error instanceof Error ? error.message : "An error occurred reading the git config file.";
printIndianRed(errMsg);