Add environment variable for custom dependency cache prefix

This commit is contained in:
Michael B. Gale 2024-10-07 10:59:35 +01:00
parent 1338dbce25
commit 8f657e857d
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
6 changed files with 29 additions and 4 deletions

View file

@ -31,6 +31,7 @@ const actionsCache = __importStar(require("@actions/cache"));
const glob = __importStar(require("@actions/glob"));
const caching_utils_1 = require("./caching-utils");
const util_1 = require("./util");
const environment_1 = require("./environment");
const CODEQL_DEPENDENCY_CACHE_PREFIX = "codeql-dependencies";
const CODEQL_DEPENDENCY_CACHE_VERSION = 1;
/**
@ -155,6 +156,11 @@ async function cacheKey(language, cacheConfig) {
*/
async function cachePrefix(language) {
const runnerOs = (0, util_1.getRequiredEnvParam)("RUNNER_OS");
return `${CODEQL_DEPENDENCY_CACHE_PREFIX}-${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
const customPrefix = process.env[environment_1.EnvVar.DEPENDENCY_CACHING_PREFIX];
let prefix = CODEQL_DEPENDENCY_CACHE_PREFIX;
if (customPrefix !== undefined && customPrefix.length > 0) {
prefix = `${prefix}-${customPrefix}`;
}
return `${prefix}-${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
}
//# sourceMappingURL=dependency-caching.js.map