Introduce external repository token

This commit is contained in:
Robert 2021-01-04 12:31:55 +00:00
parent a0c4707dcc
commit 90d1a31dd4
22 changed files with 72 additions and 41 deletions

3
lib/runner.js generated
View file

@ -83,6 +83,7 @@ program
.requiredOption("--repository <repository>", "Repository name. (Required)")
.requiredOption("--github-url <url>", "URL of GitHub instance. (Required)")
.requiredOption("--github-auth <auth>", "GitHub Apps token or personal access token. (Required)")
.option("--external-repository-token <token>", "A token for fetching external config files and queries if they reside in a private repository.")
.option("--languages <languages>", "Comma-separated list of languages to analyze. Otherwise detects and analyzes all supported languages from the repo.")
.option("--queries <queries>", "Comma-separated list of additional queries to run. This overrides the same setting in a configuration file.")
.option("--config-file <file>", "Path to config file.")
@ -95,6 +96,7 @@ program
// Remove this if commander.js starts supporting hidden options.
.allowUnknownOption()
.action(async (cmd) => {
var _a;
const logger = logging_1.getRunnerLogger(cmd.debug);
try {
const tempDir = getTempDir(cmd.tempDir);
@ -105,6 +107,7 @@ program
fs.mkdirSync(tempDir, { recursive: true });
const apiDetails = {
auth: cmd.githubAuth,
externalRepoAuth: (_a = cmd.externalRepositoryToken, (_a !== null && _a !== void 0 ? _a : cmd.githubAuth)),
url: util_1.parseGithubUrl(cmd.githubUrl),
};
const gitHubVersion = await util_1.getGitHubVersion(apiDetails);