INNER CODE UNIT · TypeScript
urlRegex
KinsonDigital/Velaptor · DevTools/create-pr.ts:56
const urlRegex = /url = (.+)/;
const urlMatch = remoteText.match(urlRegex);
if (urlMatch === null) {
printIndianRed(
"The repository does not have a remote 'origin' URL configured.",
);
Deno.exit(1);
}
const urlMatchText = urlMatch[0];
let url = urlMatchText.split("=")[1].trim();
const githubUrlRegex = /https:\/\/github\.com\/(.+\/)(.+)\.git/;
if (!githubUrlRegex.test(url)) {
printIndianRed("The remote 'origin' URL is not a valid GitHub URL.");
Deno.exit(1);