Only warn for missing config if init was successful

This commit is contained in:
Michael B. Gale committed 2026-10-22 10:37:37 +01:00
1 parent 26f5c5e4e0
commit 308d941317
6 files changed
+30 -13

No files matched your search

+12 -7
View File
@@ -174622,7 +174622,9 @@ async function initActionState({
useOverlayDatabaseCaching: false, useOverlayDatabaseCaching: false,
overlayModeSetExplicitly: false, overlayModeSetExplicitly: false,
repositoryProperties, repositoryProperties,
enableFileCoverageInformation enableFileCoverageInformation,
// We don't set this to `true` until `init` is successful.
successfullyInitialised: false
}; };
} }
async function downloadCacheWithTime(codeQL, languages, logger2, repositoryRoot) { async function downloadCacheWithTime(codeQL, languages, logger2, repositoryRoot) {
@@ -177448,12 +177450,14 @@ async function getCodeQLForCmd(logger2, cmd, checkVersion) {
async diagnosticsExport(sarifFile, automationDetailsId, config, diagnosticDir) { async diagnosticsExport(sarifFile, automationDetailsId, config, diagnosticDir) {
let configPath = getGeneratedCodeScanningConfigPath(config); let configPath = getGeneratedCodeScanningConfigPath(config);
if (!fs17.existsSync(configPath)) { if (!fs17.existsSync(configPath)) {
logger2.warning( if (config.successfullyInitialised) {
[ logger2.warning(
`Expected a configuration file at '${configPath}', which does not exist.`, [
"Continuing with diagnostics export anyway, without a configuration file." `Expected a configuration file at '${configPath}', which does not exist.`,
].join(" ") "Continuing with diagnostics export anyway, without a configuration file."
); ].join(" ")
);
}
configPath = void 0; configPath = void 0;
} }
const args = [ const args = [
@@ -186923,6 +186927,7 @@ exec ${goBinaryPath} "$@"`
); );
} }
flushDiagnostics(actionState, config); flushDiagnostics(actionState, config);
config.successfullyInitialised = true;
await saveConfig(config, logger2); await saveConfig(config, logger2);
core19.setOutput("codeql-path", config.codeQLCmd); core19.setOutput("codeql-path", config.codeQLCmd);
core19.setOutput("codeql-version", (await codeql.getVersion()).version); core19.setOutput("codeql-version", (await codeql.getVersion()).version);
+11 -6
View File
@@ -928,12 +928,17 @@ async function getCodeQLForCmd(
getGeneratedCodeScanningConfigPath(config); getGeneratedCodeScanningConfigPath(config);
if (!fs.existsSync(configPath)) { if (!fs.existsSync(configPath)) {
logger.warning( // Warn if there is no configuration file, even though `config` claims that `init`
[ // was successful. This shouldn't be happening.
`Expected a configuration file at '${configPath}', which does not exist.`, if (config.successfullyInitialised) {
"Continuing with diagnostics export anyway, without a configuration file.", logger.warning(
].join(" "), [
); `Expected a configuration file at '${configPath}', which does not exist.`,
"Continuing with diagnostics export anyway, without a configuration file.",
].join(" "),
);
}
configPath = undefined; configPath = undefined;
} }
+2
View File
@@ -465,6 +465,8 @@ export async function initActionState(
overlayModeSetExplicitly: false, overlayModeSetExplicitly: false,
repositoryProperties, repositoryProperties,
enableFileCoverageInformation, enableFileCoverageInformation,
// We don't set this to `true` until `init` is successful.
successfullyInitialised: false,
}; };
} }
+3
View File
@@ -130,6 +130,9 @@ export interface Config {
* Whether to enable file coverage information. * Whether to enable file coverage information.
*/ */
enableFileCoverageInformation: boolean; enableFileCoverageInformation: boolean;
/** Whether the analysis was successfully initialised using the configuration. */
successfullyInitialised: boolean;
} }
/** Properties available in `Config`. */ /** Properties available in `Config`. */
+1
View File
@@ -775,6 +775,7 @@ async function run(
// may have updated the config returned from `initConfig`, e.g. to revert to // may have updated the config returned from `initConfig`, e.g. to revert to
// `OverlayDatabaseMode.None` if we failed to download an overlay-base // `OverlayDatabaseMode.None` if we failed to download an overlay-base
// database. // database.
config.successfullyInitialised = true;
await configUtils.saveConfig(config, logger); await configUtils.saveConfig(config, logger);
core.setOutput("codeql-path", config.codeQLCmd); core.setOutput("codeql-path", config.codeQLCmd);
+1
View File
@@ -1031,6 +1031,7 @@ export function createTestConfig(overrides: Partial<Config>): Config {
overlayModeSetExplicitly: false, overlayModeSetExplicitly: false,
repositoryProperties: {}, repositoryProperties: {},
enableFileCoverageInformation: true, enableFileCoverageInformation: true,
successfullyInitialised: false,
} satisfies Config, } satisfies Config,
overrides, overrides,
); );