From 106fccb1d867465206a1497be11dd65ad812cdb4 Mon Sep 17 00:00:00 2001 From: Prajjwal Date: Thu, 24 Jul 2025 18:13:21 +0530 Subject: [PATCH] updates package --- dist/index.js | 21 ++++++++++++++++----- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9acd8bcd1..a13f95175 100644 --- a/dist/index.js +++ b/dist/index.js @@ -884,9 +884,11 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch // Internal Error return undefined; } + core.debug(`Cache Entry: ${JSON.stringify(cacheEntry)}`); archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); core.debug(`Archive Path: ${archivePath}`); const cacheKey = (_b = (_a = cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cache_entry) === null || _a === void 0 ? void 0 : _a.cache_user_given_key) !== null && _b !== void 0 ? _b : primaryKey; + core.debug(`Cache Key: ${cacheKey}`); switch (cacheEntry.provider) { case 's3': case 'r2': { @@ -901,7 +903,8 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch yield cacheHttpClient.downloadCache('s3', (_d = cacheEntry.s3) === null || _d === void 0 ? void 0 : _d.pre_signed_url, archivePath); } catch (error) { - core.info('Cache Miss. Failed to download cache.'); + core.debug(`Failed to download cache: ${error}`); + core.info(`Cache Miss. Failed to download cache from ${cacheEntry.provider}. Error: ${error}`); return undefined; } if (core.isDebug()) { @@ -2210,10 +2213,17 @@ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options keepAlive: true }); try { - const res = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCacheMetadata', () => __awaiter(this, void 0, void 0, function* () { return yield httpClient.request('HEAD', archiveLocation, null, {}); })); - const lengthHeader = res.message.headers['content-length']; - if (lengthHeader === undefined || lengthHeader === null) { - throw new Error('Content-Length not found on blob response'); + // Use Range request to get total file size (works with PresignGetObject URLs) + const res = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCacheMetadata', () => __awaiter(this, void 0, void 0, function* () { return yield httpClient.get(archiveLocation, { Range: 'bytes=0-0' }); })); + const contentRange = res.message.headers['content-range']; + if (!contentRange) { + throw new Error('Content-Range header not found - server may not support range requests'); + } + // Parse "bytes 0-0/12345" to get total length (12345) + const match = contentRange.match(/bytes \d+-\d+\/(\d+)/); + const lengthHeader = match === null || match === void 0 ? void 0 : match[1]; + if (!lengthHeader) { + throw new Error('Could not parse total file size from Content-Range header'); } const length = parseInt(lengthHeader); if (Number.isNaN(length)) { @@ -2257,6 +2267,7 @@ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options while (actives > 0) { yield waitAndWrite(); } + progress.stopDisplayTimer(); } finally { httpClient.dispose(); diff --git a/package.json b/package.json index d085c14b4..620c39a61 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/ruby/setup-ruby", "dependencies": { - "@actions/cache": "npm:github-actions.warp-cache@1.4.6", + "@actions/cache": "npm:github-actions.warp-cache@1.4.7", "@actions/core": "^1.10.0", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.2", diff --git a/yarn.lock b/yarn.lock index aca8860d3..45ad44a3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@actions/cache@npm:github-actions.warp-cache@1.4.6": - version "1.4.6" - resolved "https://registry.npmjs.org/github-actions.warp-cache/-/github-actions.warp-cache-1.4.6.tgz" - integrity sha512-WAB/kEi4Knb0PxS0xSWGPKJ0UNU31LzK9vpt6IYpPdk32bXicq/ncxLwN/28zssxNF+f+T1Ch79/nZcjFGUi7g== +"@actions/cache@npm:github-actions.warp-cache@1.4.7": + version "1.4.7" + resolved "https://registry.yarnpkg.com/github-actions.warp-cache/-/github-actions.warp-cache-1.4.7.tgz#a6c722b8b25a684924a8153ada700433af200f5a" + integrity sha512-TwYF+iv/l1uZRp3D0iBj+zoPZPhd3gpvKuarLxnB9de7KUFvG79M3fDIqhjjXa4l53XcfZKBt31H6UcsKiXlTw== dependencies: "@actions/core" "^1.10.0" "@actions/exec" "^1.0.1"