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;