mirror of
https://github.com/github/codeql-action.git
synced 2026-04-27 01:08:46 +00:00
Merge pull request #3232 from github/kaspersv/unique-overlay-base-keys
Ensure uniqueness of overlay-base database cache keys
This commit is contained in:
Generated
+14
-3
@@ -91070,7 +91070,8 @@ async function uploadOverlayBaseDatabaseToCache(codeql, config, logger) {
|
||||
const cacheSaveKey = await getCacheSaveKey(
|
||||
config,
|
||||
codeQlVersion,
|
||||
checkoutPath
|
||||
checkoutPath,
|
||||
logger
|
||||
);
|
||||
logger.info(
|
||||
`Uploading overlay-base database to Actions cache with key ${cacheSaveKey}`
|
||||
@@ -91095,13 +91096,23 @@ async function uploadOverlayBaseDatabaseToCache(codeql, config, logger) {
|
||||
logger.info(`Successfully uploaded overlay-base database from ${dbLocation}`);
|
||||
return true;
|
||||
}
|
||||
async function getCacheSaveKey(config, codeQlVersion, checkoutPath) {
|
||||
async function getCacheSaveKey(config, codeQlVersion, checkoutPath, logger) {
|
||||
let runId = 1;
|
||||
let attemptId = 1;
|
||||
try {
|
||||
runId = getWorkflowRunID();
|
||||
attemptId = getWorkflowRunAttempt();
|
||||
} catch (e) {
|
||||
logger.warning(
|
||||
`Failed to get workflow run ID or attempt ID. Reason: ${getErrorMessage(e)}`
|
||||
);
|
||||
}
|
||||
const sha = await getCommitOid(checkoutPath);
|
||||
const restoreKeyPrefix = await getCacheRestoreKeyPrefix(
|
||||
config,
|
||||
codeQlVersion
|
||||
);
|
||||
return `${restoreKeyPrefix}${sha}`;
|
||||
return `${restoreKeyPrefix}${sha}-${runId}-${attemptId}`;
|
||||
}
|
||||
async function getCacheRestoreKeyPrefix(config, codeQlVersion) {
|
||||
const languages = [...config.languages].sort().join("_");
|
||||
|
||||
Reference in New Issue
Block a user