mirror of
https://github.com/github/codeql-action.git
synced 2026-11-09 06:29:52 +00:00
Only warn for missing config if init was successful
This commit is contained in:
@@ -928,12 +928,17 @@ async function getCodeQLForCmd(
|
||||
getGeneratedCodeScanningConfigPath(config);
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
logger.warning(
|
||||
[
|
||||
`Expected a configuration file at '${configPath}', which does not exist.`,
|
||||
"Continuing with diagnostics export anyway, without a configuration file.",
|
||||
].join(" "),
|
||||
);
|
||||
// Warn if there is no configuration file, even though `config` claims that `init`
|
||||
// was successful. This shouldn't be happening.
|
||||
if (config.successfullyInitialised) {
|
||||
logger.warning(
|
||||
[
|
||||
`Expected a configuration file at '${configPath}', which does not exist.`,
|
||||
"Continuing with diagnostics export anyway, without a configuration file.",
|
||||
].join(" "),
|
||||
);
|
||||
}
|
||||
|
||||
configPath = undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -465,6 +465,8 @@ export async function initActionState(
|
||||
overlayModeSetExplicitly: false,
|
||||
repositoryProperties,
|
||||
enableFileCoverageInformation,
|
||||
// We don't set this to `true` until `init` is successful.
|
||||
successfullyInitialised: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,9 @@ export interface Config {
|
||||
* Whether to enable file coverage information.
|
||||
*/
|
||||
enableFileCoverageInformation: boolean;
|
||||
|
||||
/** Whether the analysis was successfully initialised using the configuration. */
|
||||
successfullyInitialised: boolean;
|
||||
}
|
||||
|
||||
/** Properties available in `Config`. */
|
||||
|
||||
@@ -775,6 +775,7 @@ async function run(
|
||||
// may have updated the config returned from `initConfig`, e.g. to revert to
|
||||
// `OverlayDatabaseMode.None` if we failed to download an overlay-base
|
||||
// database.
|
||||
config.successfullyInitialised = true;
|
||||
await configUtils.saveConfig(config, logger);
|
||||
|
||||
core.setOutput("codeql-path", config.codeQLCmd);
|
||||
|
||||
@@ -1031,6 +1031,7 @@ export function createTestConfig(overrides: Partial<Config>): Config {
|
||||
overlayModeSetExplicitly: false,
|
||||
repositoryProperties: {},
|
||||
enableFileCoverageInformation: true,
|
||||
successfullyInitialised: false,
|
||||
} satisfies Config,
|
||||
overrides,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user