Extract language appropriately in analyze step when build mode specified
This commit is contained in:
parent
db6e5fff06
commit
0fe34bd39a
23 changed files with 205 additions and 61 deletions
|
|
@ -72,6 +72,12 @@ interface IncludeQueryFilter {
|
|||
include: Record<string, string[] | string>;
|
||||
}
|
||||
|
||||
export enum BuildMode {
|
||||
None = "none",
|
||||
Autobuild = "autobuild",
|
||||
Manual = "manual",
|
||||
}
|
||||
|
||||
/**
|
||||
* Format of the parsed config file.
|
||||
*/
|
||||
|
|
@ -83,7 +89,7 @@ export interface Config {
|
|||
/**
|
||||
* Build mode, if set. Currently only a single build mode is supported per job.
|
||||
*/
|
||||
buildMode: string | undefined;
|
||||
buildMode: BuildMode | undefined;
|
||||
/**
|
||||
* A unaltered copy of the original user input.
|
||||
* Mainly intended to be used for status reporting.
|
||||
|
|
@ -466,7 +472,7 @@ export async function getDefaultConfig({
|
|||
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
buildMode: validateBuildModeInput(buildModeInput),
|
||||
originalUserInput: {},
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
|
|
@ -554,7 +560,7 @@ async function loadConfig({
|
|||
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
buildMode: validateBuildModeInput(buildModeInput),
|
||||
originalUserInput: parsedYAML,
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
|
|
@ -1056,3 +1062,20 @@ export async function wrapEnvironment(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function validateBuildModeInput(
|
||||
buildModeInput: string | undefined,
|
||||
): BuildMode | undefined {
|
||||
if (buildModeInput === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!Object.values(BuildMode).includes(buildModeInput as BuildMode)) {
|
||||
throw new UserError(
|
||||
`Invalid build mode: '${buildModeInput}'. Supported build modes are: ${Object.values(
|
||||
BuildMode,
|
||||
).join(", ")}.`,
|
||||
);
|
||||
}
|
||||
return buildModeInput as BuildMode;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue