Remove process of auth

This commit is contained in:
Robert Brignull 2020-08-27 16:45:28 +01:00
parent 1fd45d7407
commit 3dfaa88a1d
4 changed files with 4 additions and 28 deletions

13
lib/api-client.js generated
View file

@ -20,7 +20,7 @@ exports.getApiClient = function (githubAuth, githubUrl, allowLocalRun = false) {
throw new Error('Invalid API call in local run');
}
return new github.GitHub({
auth: parseAuth(githubAuth),
auth: githubAuth,
baseUrl: getApiUrl(githubUrl),
userAgent: "CodeQL Action",
log: console_log_level_1.default({ level: "debug" })
@ -37,17 +37,6 @@ function getApiUrl(githubUrl) {
url.pathname = path.join(url.pathname, 'api', 'v3');
return url.toString();
}
// Parses the user input as either a single token,
// or a username and password / PAT.
function parseAuth(auth) {
// Check if it's a username:password pair
const c = auth.indexOf(':');
if (c !== -1) {
return 'basic ' + Buffer.from(auth).toString('base64');
}
// Otherwise use the token as it is
return auth;
}
// Temporary function to aid in the transition to running on and off of github actions.
// Once all code has been coverted this function should be removed or made canonical
// and called only from the action entrypoints.