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

13
lib/util.js generated
View file

@ -321,6 +321,19 @@ function getMemoryFlag(userInput) {
return "--ram=" + Math.floor(memoryToUseMegaBytes);
}
exports.getMemoryFlag = getMemoryFlag;
/**
* Get the codeql flag to specify whether to add code snippets to the sarif file.
*
* @returns string
*/
function getAddSnippetsFlag(userInput) {
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";
}
exports.getAddSnippetsFlag = getAddSnippetsFlag;
/**
* Get the codeql `--threads` value specified for the `threads` input.
* If not value was specified, all available threads will be used.