make inputting refs easier
This commit is contained in:
parent
68c6069f0b
commit
ebb41156ee
3 changed files with 25 additions and 5 deletions
14
lib/runner.js
generated
14
lib/runner.js
generated
|
|
@ -64,6 +64,16 @@ function importTracerEnvironment(config) {
|
||||||
Object.keys(env).forEach(key => process.env[key] = env[key]);
|
Object.keys(env).forEach(key => process.env[key] = env[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Allow the user to specify refs in full refs/heads/branch format
|
||||||
|
// or just the short branch name and prepend "refs/heads/" to it.
|
||||||
|
function parseRef(userInput) {
|
||||||
|
if (userInput.startsWith('refs/')) {
|
||||||
|
return userInput;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 'refs/heads/' + userInput;
|
||||||
|
}
|
||||||
|
}
|
||||||
program
|
program
|
||||||
.command('init')
|
.command('init')
|
||||||
.description('Initializes CodeQL')
|
.description('Initializes CodeQL')
|
||||||
|
|
@ -199,7 +209,7 @@ program
|
||||||
throw new Error("Config file could not be found at expected location. " +
|
throw new Error("Config file could not be found at expected location. " +
|
||||||
"Was the 'init' command run with the same '--temp-dir' argument as this command.");
|
"Was the 'init' command run with the same '--temp-dir' argument as this command.");
|
||||||
}
|
}
|
||||||
await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, cmd.ref, undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), cmd.upload, 'runner', outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getThreadsFlag(cmd.threads, logger), config, logger);
|
await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), cmd.upload, 'runner', outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getThreadsFlag(cmd.threads, logger), config, logger);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.error('Analyze failed');
|
logger.error('Analyze failed');
|
||||||
|
|
@ -221,7 +231,7 @@ program
|
||||||
.action(async (cmd) => {
|
.action(async (cmd) => {
|
||||||
const logger = logging_1.getRunnerLogger(cmd.debug);
|
const logger = logging_1.getRunnerLogger(cmd.debug);
|
||||||
try {
|
try {
|
||||||
await upload_lib.upload(cmd.sarifFile, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, cmd.ref, undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), 'runner', logger);
|
await upload_lib.upload(cmd.sarifFile, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), 'runner', logger);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.error('Upload failed');
|
logger.error('Upload failed');
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -66,6 +66,16 @@ function importTracerEnvironment(config: Config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow the user to specify refs in full refs/heads/branch format
|
||||||
|
// or just the short branch name and prepend "refs/heads/" to it.
|
||||||
|
function parseRef(userInput: string): string {
|
||||||
|
if (userInput.startsWith('refs/')) {
|
||||||
|
return userInput;
|
||||||
|
} else {
|
||||||
|
return 'refs/heads/' + userInput;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interface InitArgs {
|
interface InitArgs {
|
||||||
languages: string | undefined;
|
languages: string | undefined;
|
||||||
queries: string | undefined;
|
queries: string | undefined;
|
||||||
|
|
@ -265,7 +275,7 @@ program
|
||||||
await runAnalyze(
|
await runAnalyze(
|
||||||
parseRepositoryNwo(cmd.repository),
|
parseRepositoryNwo(cmd.repository),
|
||||||
cmd.commit,
|
cmd.commit,
|
||||||
cmd.ref,
|
parseRef(cmd.ref),
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
@ -316,7 +326,7 @@ program
|
||||||
cmd.sarifFile,
|
cmd.sarifFile,
|
||||||
parseRepositoryNwo(cmd.repository),
|
parseRepositoryNwo(cmd.repository),
|
||||||
cmd.commit,
|
cmd.commit,
|
||||||
cmd.ref,
|
parseRef(cmd.ref),
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue