Improve error handling for overlay-base cache key creation

This commit is contained in:
Kasper Svendsen
2025-10-24 15:48:42 +02:00
parent cbcae45fff
commit 66759e57b2
3 changed files with 33 additions and 7 deletions
+13 -4
View File
@@ -91049,7 +91049,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}`
@@ -91074,9 +91075,17 @@ async function uploadOverlayBaseDatabaseToCache(codeql, config, logger) {
logger.info(`Successfully uploaded overlay-base database from ${dbLocation}`);
return true;
}
async function getCacheSaveKey(config, codeQlVersion, checkoutPath) {
const runId = getWorkflowRunID();
const attemptId = getWorkflowRunAttempt();
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,