mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
Parse the config input once
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
43
lib/entry-points.js
generated
43
lib/entry-points.js
generated
@@ -149271,16 +149271,7 @@ var DEFAULT_SETUP_CONFIG_SCHEMA = {
|
||||
function checkDefaultSetupConfig(config) {
|
||||
return checkSchema(DEFAULT_SETUP_CONFIG_SCHEMA, config);
|
||||
}
|
||||
function matchesDefaultSetupConfigSchema(contents) {
|
||||
let config;
|
||||
try {
|
||||
config = load(contents);
|
||||
} catch (error3) {
|
||||
if (error3 instanceof YAMLException) {
|
||||
return false;
|
||||
}
|
||||
throw error3;
|
||||
}
|
||||
function matchesDefaultSetupConfigSchema(config) {
|
||||
if (!isObject(config)) {
|
||||
return false;
|
||||
}
|
||||
@@ -150864,20 +150855,22 @@ async function applyIncrementalAnalysisSettings(config, hasDiffRanges, codeql, l
|
||||
});
|
||||
}
|
||||
}
|
||||
async function determineUserConfig(action, tempDir, inputs) {
|
||||
const validateConfig = await action.features.getValue(
|
||||
"validate_db_config" /* ValidateDbConfig */
|
||||
async function parseConfigInput({ logger, features }, configInput) {
|
||||
if (configInput === void 0) {
|
||||
return void 0;
|
||||
}
|
||||
return parseUserConfig(
|
||||
logger,
|
||||
"`config` input",
|
||||
configInput,
|
||||
await features.getValue("validate_db_config" /* ValidateDbConfig */)
|
||||
);
|
||||
if (inputs.configInput) {
|
||||
}
|
||||
async function determineUserConfig(action, tempDir, inputs) {
|
||||
if (inputs.configInput !== void 0) {
|
||||
const computedConfigPath = userConfigFromActionPath(tempDir);
|
||||
const allowMergeConfigs = () => action.features.getValue("allow_merge_config_files" /* AllowMergeConfigFiles */);
|
||||
if (inputs.configFile && isDefaultSetup(action.env) && await allowMergeConfigs()) {
|
||||
const fromConfigInput = parseUserConfig(
|
||||
action.logger,
|
||||
"`config` input",
|
||||
inputs.configInput,
|
||||
validateConfig
|
||||
);
|
||||
const fromConfigFile = await loadUserConfig(
|
||||
action,
|
||||
inputs.configFile,
|
||||
@@ -150887,7 +150880,7 @@ async function determineUserConfig(action, tempDir, inputs) {
|
||||
);
|
||||
const mergedConfig = mergeDefaultSetupAndUserConfigs(
|
||||
action.logger,
|
||||
fromConfigInput,
|
||||
inputs.configInput,
|
||||
fromConfigFile
|
||||
);
|
||||
fs10.writeFileSync(computedConfigPath, dump(mergedConfig));
|
||||
@@ -150902,11 +150895,12 @@ async function determineUserConfig(action, tempDir, inputs) {
|
||||
`Both a config file and config input were provided. Ignoring config file.`
|
||||
);
|
||||
}
|
||||
fs10.writeFileSync(computedConfigPath, inputs.configInput);
|
||||
fs10.writeFileSync(computedConfigPath, dump(inputs.configInput));
|
||||
inputs.configFile = computedConfigPath;
|
||||
action.logger.debug(
|
||||
`Using config from action input: ${inputs.configFile}`
|
||||
);
|
||||
return inputs.configInput;
|
||||
}
|
||||
}
|
||||
if (!inputs.configFile) {
|
||||
@@ -162396,7 +162390,10 @@ async function run3(actionState) {
|
||||
const rawLanguages = getRawLanguagesNoAutodetect(
|
||||
getOptionalInput("languages")
|
||||
);
|
||||
const configInput = getOptionalInput("config");
|
||||
const configInput = await parseConfigInput(
|
||||
actionStateWithFeatures,
|
||||
getOptionalInput("config")
|
||||
);
|
||||
const queriesInput = getOptionalInput("queries");
|
||||
const otherLanguagePacksReason = getOtherLanguagePacksReason({
|
||||
configFile,
|
||||
|
||||
Reference in New Issue
Block a user