Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add build mode to configuration
  • Loading branch information
henrymercer committed Jan 30, 2024
commit 0166a8a567cb0636637a96efaaa4f94fc385886e
6 changes: 4 additions & 2 deletions lib/config-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lib/config-utils.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.test.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/init-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init-action.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/testing-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/testing-utils.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/config-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function createTestInitConfigInputs(
configFile: undefined,
dbLocation: undefined,
configInput: undefined,
buildModeInput: undefined,
trapCachingEnabled: false,
debugMode: false,
debugArtifactName: "",
Expand Down Expand Up @@ -322,6 +323,7 @@ test("load non-empty input", async (t) => {
// And the config we expect it to parse to
const expectedConfig: configUtils.Config = {
languages: [Language.javascript],
buildMode: "none",
originalUserInput: {
name: "my config",
"disable-default-queries": true,
Expand All @@ -347,6 +349,7 @@ test("load non-empty input", async (t) => {
const actualConfig = await configUtils.initConfig(
createTestInitConfigInputs({
languagesInput,
buildModeInput: "none",
configFile: configFilePath,
debugArtifactName: "my-artifact",
debugDatabaseName: "my-db",
Expand Down
9 changes: 9 additions & 0 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export interface Config {
* Set of languages to run analysis for.
*/
languages: Language[];
/**
* Build mode, if set. Currently only a single build mode is supported per job.
*/
buildMode: string | undefined;
/**
* A unaltered copy of the original user input.
* Mainly intended to be used for status reporting.
Expand Down Expand Up @@ -399,6 +403,7 @@ export interface InitConfigInputs {
configFile: string | undefined;
dbLocation: string | undefined;
configInput: string | undefined;
buildModeInput: string | undefined;
trapCachingEnabled: boolean;
debugMode: boolean;
debugArtifactName: string;
Expand Down Expand Up @@ -428,6 +433,7 @@ export async function getDefaultConfig({
languagesInput,
queriesInput,
packsInput,
buildModeInput,
dbLocation,
trapCachingEnabled,
debugMode,
Expand Down Expand Up @@ -460,6 +466,7 @@ export async function getDefaultConfig({

return {
languages,
buildMode: buildModeInput,
originalUserInput: {},
tempDir,
codeQLCmd: codeql.getPath(),
Expand Down Expand Up @@ -500,6 +507,7 @@ async function loadConfig({
languagesInput,
queriesInput,
packsInput,
buildModeInput,
configFile,
dbLocation,
trapCachingEnabled,
Expand Down Expand Up @@ -546,6 +554,7 @@ async function loadConfig({

return {
languages,
buildMode: buildModeInput,
originalUserInput: parsedYAML,
tempDir,
codeQLCmd: codeql.getPath(),
Expand Down
1 change: 1 addition & 0 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ async function run() {
languagesInput: getOptionalInput("languages"),
queriesInput: getOptionalInput("queries"),
packsInput: getOptionalInput("packs"),
buildModeInput: getOptionalInput("build-mode"),
configFile: getOptionalInput("config-file"),
dbLocation: getOptionalInput("db-location"),
configInput: getOptionalInput("config"),
Expand Down
Loading