From fa426edd9aea8efdd3094e6d9f94ce00f68fc4b3 Mon Sep 17 00:00:00 2001 From: newbiejanghan Date: Thu, 2 May 2024 15:11:15 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20getGithubUsername.js=20/=20email=20strin?= =?UTF-8?q?g=20=EC=97=90=20+=EA=B0=80=20=EC=97=86=EB=8A=94=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EC=A0=9C=EB=8C=80=EB=A1=9C=20local=20=EC=9D=B4=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=EB=90=98=EC=A7=80=20=EC=95=8A=EC=95=84=20git?= =?UTF-8?q?hubId=EA=B0=80=20undefined=20=EC=9D=B8=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/utils/getGithubUsername.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/utils/getGithubUsername.js b/lib/utils/getGithubUsername.js index 3be022e..0dbca05 100644 --- a/lib/utils/getGithubUsername.js +++ b/lib/utils/getGithubUsername.js @@ -4,10 +4,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.getGithubUsername = void 0; const child_process_1 = require("child_process"); const getGithubUsername = () => { - const gitUrl = (0, child_process_1.execSync)("git config --get user.email") + const gitUserEmail = (0, child_process_1.execSync)("git config --get user.email") .toString() .trim(); - const githubId = gitUrl.split("@")[0].split("+")[1]; - return githubId; + + const gitUserNameStr = (0, child_process_1.execSync)("git config --get user.name") + .toString() + .trim(); + + const getValidGithubId = (email) => { + const local = email.split("@")[0]; + return local.includes("+") ? local.split("+")[1] : local; + } + + return getValidGithubId(gitUserEmail); }; exports.getGithubUsername = getGithubUsername;