@ -92559,15 +92559,21 @@ function restoreFromGCS(_paths_1, primaryKey_1) {
const archiveFolder = yield utils . createTempDirectory ( ) ;
const archiveFolder = yield utils . createTempDirectory ( ) ;
const archivePath = path . join ( archiveFolder , utils . getCacheFileName ( compressionMethod ) ) ;
const archivePath = path . join ( archiveFolder , utils . getCacheFileName ( compressionMethod ) ) ;
const keys = [ primaryKey , ... restoreKeys ] ;
const keys = [ primaryKey , ... restoreKeys ] ;
const gcsPat h = yield findFileOnGCS ( storage , bucket , pathPrefix , keys , compressionMethod ) ;
const matc h = yield findFileOnGCS ( storage , bucket , pathPrefix , keys , compressionMethod ) ;
if ( ! gcsPat h) {
if ( ! matc h) {
core . info ( ` No matching cache found ` ) ;
core . info ( ` No matching cache found ` ) ;
return undefined ;
return undefined ;
}
}
// Preserve the @actions/cache contract: return the matched cache KEY
// (primaryKey or a restoreKey), not the GCS object path. The caller
// (restoreImpl) compares the return value against primaryKey to set the
// `cache-hit` output — returning the gcs path makes `cache-hit` always
// false, re-triggering downstream install/build steps that gate on it.
const { key : matchedKey , path : gcsPath } = match ;
// If lookup only, just return the key
// If lookup only, just return the key
if ( options === null || options === void 0 ? void 0 : options . lookupOnly ) {
if ( options === null || options === void 0 ? void 0 : options . lookupOnly ) {
core . info ( ` Cache found in GCS with key: ${ gcsPath } ` ) ;
core . info ( ` Cache found in GCS with key: ${ matchedKey } ` ) ;
return gcsPath ;
return matchedKey ;
}
}
try {
try {
core . info ( ` Downloading from GCS: ${ bucket } / ${ gcsPath } ` ) ;
core . info ( ` Downloading from GCS: ${ bucket } / ${ gcsPath } ` ) ;
@ -92580,7 +92586,7 @@ function restoreFromGCS(_paths_1, primaryKey_1) {
core . info ( ` Cache Size: ~ ${ Math . round ( archiveFileSize / ( 1024 * 1024 ) ) } MB ( ${ archiveFileSize } B) ` ) ;
core . info ( ` Cache Size: ~ ${ Math . round ( archiveFileSize / ( 1024 * 1024 ) ) } MB ( ${ archiveFileSize } B) ` ) ;
yield ( 0 , tar _1 . extractTar ) ( archivePath , compressionMethod ) ;
yield ( 0 , tar _1 . extractTar ) ( archivePath , compressionMethod ) ;
core . info ( "Cache restored successfully" ) ;
core . info ( "Cache restored successfully" ) ;
return gcsPath ;
return matchedKey ;
}
}
catch ( error ) {
catch ( error ) {
core . warning ( ` Failed to restore: ${ error . message } ` ) ;
core . warning ( ` Failed to restore: ${ error . message } ` ) ;
@ -92649,7 +92655,7 @@ function findFileOnGCS(storage, bucket, pathPrefix, keys, compressionMethod) {
const gcsPath = getGCSPath ( pathPrefix , key , compressionMethod ) ;
const gcsPath = getGCSPath ( pathPrefix , key , compressionMethod ) ;
if ( yield checkFileExists ( storage , bucket , gcsPath ) ) {
if ( yield checkFileExists ( storage , bucket , gcsPath ) ) {
core . info ( ` Found file on bucket: ${ bucket } with key: ${ gcsPath } ` ) ;
core . info ( ` Found file on bucket: ${ bucket } with key: ${ gcsPath } ` ) ;
return gcsPath ;
return { key , path : gcsPath } ;
}
}
}
}
return undefined ;
return undefined ;