add optional workflow input to specify whether snippets are added to sarif output

This commit is contained in:
Nick Fyson 2020-09-10 17:18:02 +01:00
parent 75af0bf309
commit 77f767cb34
19 changed files with 79 additions and 20 deletions

View file

@ -386,6 +386,19 @@ export function getMemoryFlag(userInput: string | undefined): string {
return "--ram=" + Math.floor(memoryToUseMegaBytes);
}
/**
* Get the codeql flag to specify whether to add code snippets to the sarif file.
*
* @returns string
*/
export function getAddSnippetsFlag(userInput: string | boolean | undefined): string {
if (typeof userInput === "string") {
// have to process specifically because any non-empty string is truthy
userInput = userInput.toLowerCase() === "true";
}
return userInput ? "--sarif-add-snippets" : "--no-sarif-add-snippets";
}
/**
* Get the codeql `--threads` value specified for the `threads` input.
* If not value was specified, all available threads will be used.