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

View file

@ -11,7 +11,7 @@ export const getApiClient = function(githubAuth: string, githubUrl: string, allo
}
return new github.GitHub(
{
auth: parseAuth(githubAuth),
auth: githubAuth,
baseUrl: getApiUrl(githubUrl),
userAgent: "CodeQL Action",
log: consoleLogLevel({ level: "debug" })
@ -32,19 +32,6 @@ function getApiUrl(githubUrl: string): string {
return url.toString();
}
// Parses the user input as either a single token,
// or a username and password / PAT.
function parseAuth(auth: string): string {
// 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.

View file

@ -84,7 +84,7 @@ program
.description('Initializes CodeQL')
.requiredOption('--repository <repository>', 'Repository name')
.requiredOption('--github-url <url>', 'URL of GitHub instance')
.requiredOption('--github-auth <auth>', 'GitHub Apps token, or of the form "username:token" if using a personal access token')
.requiredOption('--github-auth <auth>', 'GitHub Apps token or personal access token')
.option('--languages <languages>', 'Comma-separated list of languages to analyze. Defaults to trying to detect languages from the repo.')
.option('--queries <queries>', 'Comma-separated list of additional queries to run. By default, this overrides the same setting in a configuration file.')
.option('--config-file <file>', 'Path to config file')