mirror of
https://github.com/github/codeql-action.git
synced 2026-10-31 09:59:43 +00:00
Store partial configuration when init is aborted
This commit is contained in:
54
lib/entry-points.js
generated
54
lib/entry-points.js
generated
@@ -175095,20 +175095,45 @@ function getLocalConfig(logger2, configFile, validateConfig) {
|
||||
function getPathToParsedConfigFile(tempDir) {
|
||||
return path11.join(tempDir, "config");
|
||||
}
|
||||
async function saveConfig(config, logger2) {
|
||||
function getPathToFailedConfigFile(tempDir) {
|
||||
return path11.join(tempDir, "failed-config");
|
||||
}
|
||||
function saveConfigFile(logger2, configFilePath, config) {
|
||||
const configString = JSON.stringify(config);
|
||||
const configFile = getPathToParsedConfigFile(config.tempDir);
|
||||
fs11.mkdirSync(path11.dirname(configFile), { recursive: true });
|
||||
fs11.writeFileSync(configFile, configString, "utf8");
|
||||
fs11.mkdirSync(path11.dirname(configFilePath), { recursive: true });
|
||||
fs11.writeFileSync(configFilePath, configString, "utf8");
|
||||
logger2.debug("Saved config:");
|
||||
logger2.debug(configString);
|
||||
}
|
||||
async function getConfig(tempDir, logger2) {
|
||||
const configFile = getPathToParsedConfigFile(tempDir);
|
||||
if (!fs11.existsSync(configFile)) {
|
||||
async function saveConfig(config, logger2) {
|
||||
const configFile = getPathToParsedConfigFile(config.tempDir);
|
||||
saveConfigFile(logger2, configFile, config);
|
||||
}
|
||||
function saveAbortedInitConfig(action, config) {
|
||||
if (action.name !== "init" /* Init */) {
|
||||
return;
|
||||
}
|
||||
const failedConfig = {
|
||||
version: config.version,
|
||||
tempDir: config.tempDir,
|
||||
codeQLCmd: config.codeQLCmd,
|
||||
debugMode: config.debugMode,
|
||||
gitHubVersion: config.gitHubVersion,
|
||||
languages: config.languages,
|
||||
analysisKinds: config.analysisKinds
|
||||
};
|
||||
action.logger.debug(`Saving config for failed init step.`);
|
||||
saveConfigFile(
|
||||
action.logger,
|
||||
getPathToFailedConfigFile(config.tempDir),
|
||||
failedConfig
|
||||
);
|
||||
}
|
||||
function readConfigFile(logger2, configFilePath) {
|
||||
if (!fs11.existsSync(configFilePath)) {
|
||||
return void 0;
|
||||
}
|
||||
const configString = fs11.readFileSync(configFile, "utf8");
|
||||
const configString = fs11.readFileSync(configFilePath, "utf8");
|
||||
logger2.debug("Loaded config:");
|
||||
logger2.debug(configString);
|
||||
const config = JSON.parse(configString);
|
||||
@@ -175129,6 +175154,10 @@ async function getConfig(tempDir, logger2) {
|
||||
}
|
||||
return config;
|
||||
}
|
||||
async function getConfig(tempDir, logger2) {
|
||||
const configFile = getPathToParsedConfigFile(tempDir);
|
||||
return readConfigFile(logger2, configFile);
|
||||
}
|
||||
async function generateRegistries(registriesInput, tempDir, logger2) {
|
||||
const registries = parseRegistries(registriesInput);
|
||||
let registriesAuthTokens;
|
||||
@@ -186570,6 +186599,15 @@ async function run3(actionState) {
|
||||
}
|
||||
await checkInstallPython311(config.languages, codeql);
|
||||
} catch (unwrappedError) {
|
||||
if (config !== void 0) {
|
||||
try {
|
||||
saveAbortedInitConfig(actionState, config);
|
||||
} catch (configSaveError) {
|
||||
logger2.warning(
|
||||
`Unable to save configuration for '${"init-post" /* InitPost */}' step: ${getErrorMessage(configSaveError)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
const error3 = wrapError(unwrappedError);
|
||||
core19.setFailed(error3.message);
|
||||
const statusReportBase = await createStatusReportBase(
|
||||
|
||||
Reference in New Issue
Block a user