Store and check action version in Config

This commit is contained in:
Michael B. Gale
2025-09-10 12:43:56 +01:00
parent eb50a881d8
commit 4f56152a48
12 changed files with 171 additions and 10 deletions

13
lib/upload-lib.js generated
View File

@@ -89403,7 +89403,18 @@ async function getConfig(tempDir, logger) {
const configString = fs7.readFileSync(configFile, "utf8");
logger.debug("Loaded config:");
logger.debug(configString);
return JSON.parse(configString);
const config = JSON.parse(configString);
if (config.version === void 0) {
throw new ConfigurationError(
`Loaded configuration file, but it does not contain the expected 'version' field.`
);
}
if (config.version !== getActionVersion()) {
throw new ConfigurationError(
`Loaded a configuration file for version '${config.version}', but running version '${getActionVersion()}'`
);
}
return config;
}
function appendExtraQueryExclusions(extraQueryExclusions, cliConfig) {
const augmentedConfig = cloneObject(cliConfig);