fix(dev-infra): only create authenticated github instance once in yargs (#41603)
Fix github token option for yargs to only create an authenticated token one time. PR Close #41603
This commit is contained in:
parent
c9aa87cec0
commit
15c307b200
|
@ -805,7 +805,12 @@ function addGithubTokenOption(yargs) {
|
|||
error(yellow("You can generate a token here: " + GITHUB_TOKEN_GENERATE_URL));
|
||||
process.exit(1);
|
||||
}
|
||||
try {
|
||||
GitClient.getAuthenticatedInstance();
|
||||
}
|
||||
catch (_a) {
|
||||
GitClient.authenticateWithToken(githubToken);
|
||||
}
|
||||
return githubToken;
|
||||
},
|
||||
})
|
||||
|
|
|
@ -32,7 +32,11 @@ export function addGithubTokenOption(yargs: Argv): ArgvWithGithubToken {
|
|||
error(yellow(`You can generate a token here: ${GITHUB_TOKEN_GENERATE_URL}`));
|
||||
process.exit(1);
|
||||
}
|
||||
try {
|
||||
GitClient.getAuthenticatedInstance();
|
||||
} catch {
|
||||
GitClient.authenticateWithToken(githubToken);
|
||||
}
|
||||
return githubToken;
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue