Resolve the final dependency cycle!

This commit is contained in:
Henry Mercer 2023-07-19 17:37:43 +01:00
parent 5658fd1df2
commit bac7c32ff7
13 changed files with 106 additions and 105 deletions

View file

@ -7,11 +7,7 @@ import * as yaml from "js-yaml";
import { getOptionalInput, isAnalyzingDefaultBranch } from "./actions-util";
import * as api from "./api-client";
import {
Config,
getGeneratedCodeScanningConfigPath,
getMlPoweredJsQueriesPack,
} from "./config-utils";
import type { Config } from "./config-utils";
import { EnvVar } from "./environment";
import { errorMatchers } from "./error-matcher";
import {
@ -1211,7 +1207,7 @@ async function generateCodeScanningConfig(
if (config.augmentationProperties.injectedMlQueries) {
// We need to inject the ML queries into the original user input before
// we pass this on to the CLI, to make sure these get run.
const packString = await getMlPoweredJsQueriesPack(codeql);
const packString = await util.getMlPoweredJsQueriesPack(codeql);
if (augmentedConfig.packs === undefined) augmentedConfig.packs = [];
if (Array.isArray(augmentedConfig.packs)) {
@ -1287,3 +1283,12 @@ export async function getTrapCachingExtractorConfigArgsForLang(
`-O=${language}.trap.cache.write=${write}`,
];
}
/**
* Get the path to the code scanning configuration generated by the CLI.
*
* This will not exist if the configuration is being parsed in the Action.
*/
export function getGeneratedCodeScanningConfigPath(config: Config): string {
return path.resolve(config.tempDir, "user-config.yaml");
}