@@ -39023,7 +39023,7 @@ module.exports = { version: packageJson.version }
3902339023/***/ 4012:
3902439024/***/ ((module) => {
3902539025
39026- module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"6.1.0","description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","type":"module","main":"lib/cache.js","types":"lib/cache.d.ts","exports":{".":{"types":"./lib/cache.d.ts","import":"./lib/cache.js"}},"directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^3.0.1","@actions/exec":"^3.0.0","@actions/glob":"^0.6.1","@actions/http-client":"^4.0.1","@actions/io":"^3.0.2","@azure/core-rest-pipeline":"^1.23.0","@azure/storage-blob":"^12.31.0","@protobuf-ts/runtime-rpc":"^2.11.1","semver":"^7.7.4"},"devDependencies":{"@protobuf-ts/plugin":"^2.11.1","@types/node":"^25.6.0","@types/semver":"^7.7.1","typescript":"^5.9.3"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
39026+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"6.2.0","description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","type":"module","main":"lib/cache.js","types":"lib/cache.d.ts","exports":{".":{"types":"./lib/cache.d.ts","import":"./lib/cache.js"}},"directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^3.0.1","@actions/exec":"^3.0.0","@actions/glob":"^0.6.1","@actions/http-client":"^4.0.1","@actions/io":"^3.0.2","@azure/core-rest-pipeline":"^1.23.0","@azure/storage-blob":"^12.31.0","@protobuf-ts/runtime-rpc":"^2.11.1","semver":"^7.7.4"},"devDependencies":{"@protobuf-ts/plugin":"^2.11.1","@types/node":"^25.6.0","@types/semver":"^7.7.1","typescript":"^5.9.3"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
3902739027
3902839028/***/ })
3902939029
@@ -44068,6 +44068,10 @@ const SystemTarPathOnWindows = `${process.env['SYSTEMDRIVE']}\\Windows\\System32
4406844068const TarFilename = 'cache.tar';
4406944069const ManifestFilename = 'manifest.txt';
4407044070const CacheFileSizeLimit = 10 * Math.pow(1024, 3); // 10GiB per repository
44071+ // Prefix the cache backend embeds in a read-denial message (v2 twirp
44072+ // GetCacheEntryDownloadURL error or the GHES v1 `_apis/artifactcache` 403 body).
44073+ // Shared so cache.ts and cacheHttpClient.ts match the same contract value.
44074+ const constants_CacheReadDeniedMessagePrefix = 'cache read denied:';
4407144075//# sourceMappingURL=constants.js.map
4407244076;// CONCATENATED MODULE: ./node_modules/@actions/cache/lib/internal/cacheUtils.js
4407344077var cacheUtils_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -93948,6 +93952,24 @@ function config_getCacheServiceVersion() {
9394893952 return 'v1';
9394993953 return process.env['ACTIONS_CACHE_SERVICE_V2'] ? 'v2' : 'v1';
9395093954}
93955+ // The cache-mode lattice: readable = {read, write}, writable = {write,
93956+ // write-only}, none = neither.
93957+ const KNOWN_CACHE_MODES = ['none', 'read', 'write', 'write-only'];
93958+ // The effective cache-mode exported by the runner, or '' when not set.
93959+ function config_getCacheMode() {
93960+ return (process.env['ACTIONS_CACHE_MODE'] || '').trim().toLowerCase();
93961+ }
93962+ // Unset or unrecognized modes are permissive so behavior matches today.
93963+ function config_isCacheReadable(mode) {
93964+ if (!KNOWN_CACHE_MODES.includes(mode))
93965+ return true;
93966+ return mode === 'read' || mode === 'write';
93967+ }
93968+ function isCacheWritable(mode) {
93969+ if (!KNOWN_CACHE_MODES.includes(mode))
93970+ return true;
93971+ return mode === 'write' || mode === 'write-only';
93972+ }
9395193973function getCacheServiceURL() {
9395293974 const version = config_getCacheServiceVersion();
9395393975 // Based on the version of the cache service, we will determine which
@@ -93997,6 +94019,7 @@ var cacheHttpClient_awaiter = (undefined && undefined.__awaiter) || function (th
9399794019
9399894020
9399994021
94022+
9400094023function getCacheApiurl(/?url=https%3A%2F%2Fgithub.com%2Factions%2Fsetup-java%2Fcommit%2Fresource) {
9400194024 const baseUrl = getCacheServiceURL();
9400294025 if (!baseUrl) {
@@ -94024,6 +94047,7 @@ function createHttpClient() {
9402494047}
9402594048function getCacheEntry(keys, paths, options) {
9402694049 return cacheHttpClient_awaiter(this, void 0, void 0, function* () {
94050+ var _a;
9402794051 const httpClient = createHttpClient();
9402894052 const version = utils.getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);
9402994053 const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
@@ -94037,6 +94061,12 @@ function getCacheEntry(keys, paths, options) {
9403794061 return null;
9403894062 }
9403994063 if (!isSuccessStatusCode(response.statusCode)) {
94064+ // Only surface the receiver's body for a `cache read denied:` policy denial
94065+ // so callers can dispatch on it; keep the generic message otherwise.
94066+ const errorMessage = (_a = response.error) === null || _a === void 0 ? void 0 : _a.message;
94067+ if (errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.includes(CacheReadDeniedMessagePrefix)) {
94068+ throw new Error(errorMessage);
94069+ }
9404094070 throw new Error(`Cache service responded with ${response.statusCode}`);
9404194071 }
9404294072 const cacheResult = response.result;
@@ -95297,6 +95327,7 @@ var cache_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
9529795327
9529895328
9529995329
95330+
9530095331class ValidationError extends Error {
9530195332 constructor(message) {
9530295333 super(message);
@@ -95312,19 +95343,20 @@ class ReserveCacheError extends Error {
9531295343 }
9531395344}
9531495345/**
95315- * Stable prefix the receiver writes into the cache reservation response when
95316- * the issuer downgraded the cache token to read-only (for example, because
95346+ * Stable prefix the cache service writes into the cache reservation response
95347+ * when the issuer downgraded the cache token to read-only (for example, because
9531795348 * the run was triggered by an untrusted event). saveCacheV1 / saveCacheV2
95318- * dispatch on this prefix to re-classify the failure as a
95319- * CacheWriteDeniedError so consumers (and the outer catch arm) can
95320- * distinguish a policy denial from other reservation failures.
95349+ * dispatch on this prefix to re-classify the failure as a CacheWriteDeniedError
95350+ * so consumers and tests can distinguish a policy denial from other reservation
95351+ * failures. Internally it is logged as a non-fatal warning like other
95352+ * best-effort save failures.
9532195353 */
9532295354const CACHE_WRITE_DENIED_PREFIX = 'cache write denied:';
9532395355/**
9532495356 * Raised when the cache backend refuses to reserve a writable cache entry
9532595357 * because the JWT issued for this run was scoped read-only (for example, the
9532695358 * run was triggered by an event the repository administrator classified as
95327- * untrusted). The receiver -supplied detail message always begins with
95359+ * untrusted). The service -supplied detail message always begins with
9532895360 * `cache write denied:` (the full error message includes additional context
9532995361 * like the cache key).
9533095362 *
@@ -95340,6 +95372,19 @@ class CacheWriteDeniedError extends ReserveCacheError {
9534095372 Object.setPrototypeOf(this, CacheWriteDeniedError.prototype);
9534195373 }
9534295374}
95375+ // Re-exported from constants so consumers keep referencing it here; the shared
95376+ // value also drives detection in cacheHttpClient without duplicating the string.
95377+ const CACHE_READ_DENIED_PREFIX = (/* unused pure expression or super */ null && (CacheReadDeniedMessagePrefix));
95378+ // Raised when the cache backend denies a download URL because the run's token
95379+ // has no readable cache scopes. Caching is best-effort, so restoreCache logs a
95380+ // warning and reports a cache miss rather than rethrowing this.
95381+ class CacheReadDeniedError extends Error {
95382+ constructor(message) {
95383+ super(message);
95384+ this.name = 'CacheReadDeniedError';
95385+ Object.setPrototypeOf(this, CacheReadDeniedError.prototype);
95386+ }
95387+ }
9534395388class FinalizeCacheError extends Error {
9534495389 constructor(message) {
9534595390 super(message);
@@ -95394,6 +95439,12 @@ function restoreCache(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9539495439 const cacheServiceVersion = getCacheServiceVersion();
9539595440 core.debug(`Cache service version: ${cacheServiceVersion}`);
9539695441 checkPaths(paths);
95442+ const cacheMode = getCacheMode();
95443+ if (!isCacheReadable(cacheMode)) {
95444+ core.info(`Cache restore skipped: the effective cache-mode '${cacheMode}' does not permit reads.`);
95445+ core.debug(`Skipped restore for paths [${paths.join(', ')}] with primary key '${primaryKey}'.`);
95446+ return undefined;
95447+ }
9539795448 switch (cacheServiceVersion) {
9539895449 case 'v2':
9539995450 return yield restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
@@ -95415,6 +95466,7 @@ function restoreCache(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9541595466 */
9541695467function restoreCacheV1(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9541795468 return cache_awaiter(this, arguments, void 0, function* (paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
95469+ var _a;
9541895470 restoreKeys = restoreKeys || [];
9541995471 const keys = [primaryKey, ...restoreKeys];
9542095472 core.debug('Resolved Keys:');
@@ -95429,10 +95481,26 @@ function restoreCacheV1(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9542995481 let archivePath = '';
9543095482 try {
9543195483 // path are needed to compute version
95432- const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
95433- compressionMethod,
95434- enableCrossOsArchive
95435- });
95484+ let cacheEntry;
95485+ try {
95486+ cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
95487+ compressionMethod,
95488+ enableCrossOsArchive
95489+ });
95490+ }
95491+ catch (error) {
95492+ // The v1 artifact cache service returns HTTP 403 with a
95493+ // `cache read denied:` body when the run's token has no readable cache
95494+ // scopes. getCacheEntry lives in a dependency-free internal module and
95495+ // cannot import CacheReadDeniedError without a circular dependency, so it
95496+ // only surfaces the raw denial message; we classify it into the typed
95497+ // error here so the outer catch and consumers can dispatch on it.
95498+ const errorMessage = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
95499+ if (errorMessage.includes(CACHE_READ_DENIED_PREFIX)) {
95500+ throw new CacheReadDeniedError(errorMessage);
95501+ }
95502+ throw error;
95503+ }
9543695504 if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
9543795505 // Cache not found
9543895506 return undefined;
@@ -95461,7 +95529,9 @@ function restoreCacheV1(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9546195529 }
9546295530 else {
9546395531 // warn on cache restore failure and continue build
95464- // Log server errors (5xx) as errors, all other errors as warnings
95532+ // Log server errors (5xx) as errors, all other errors as warnings.
95533+ // A read denied by policy (CacheReadDeniedError) is not an HttpClientError
95534+ // so it falls here and is warned, treated as a cache miss.
9546595535 if (typedError instanceof HttpClientError &&
9546695536 typeof typedError.statusCode === 'number' &&
9546795537 typedError.statusCode >= 500) {
@@ -95496,6 +95566,7 @@ function restoreCacheV1(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9549695566 */
9549795567function restoreCacheV2(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9549895568 return cache_awaiter(this, arguments, void 0, function* (paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
95569+ var _a;
9549995570 // Override UploadOptions to force the use of Azure
9550095571 options = Object.assign(Object.assign({}, options), { useAzureSdk: true });
9550195572 restoreKeys = restoreKeys || [];
@@ -95517,7 +95588,20 @@ function restoreCacheV2(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9551795588 restoreKeys,
9551895589 version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive)
9551995590 };
95520- const response = yield twirpClient.GetCacheEntryDownloadurl(/?url=https%3A%2F%2Fgithub.com%2Factions%2Fsetup-java%2Fcommit%2Frequest);
95591+ let response;
95592+ try {
95593+ response = yield twirpClient.GetCacheEntryDownloadurl(/?url=https%3A%2F%2Fgithub.com%2Factions%2Fsetup-java%2Fcommit%2Frequest);
95594+ }
95595+ catch (error) {
95596+ // The receiver returns twirp PermissionDenied (403) when the run's token
95597+ // has no readable cache scopes. The client wraps that 403, so the stable
95598+ // prefix is embedded in the message rather than leading it.
95599+ const errorMessage = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
95600+ if (errorMessage.includes(CACHE_READ_DENIED_PREFIX)) {
95601+ throw new CacheReadDeniedError(errorMessage);
95602+ }
95603+ throw error;
95604+ }
9552195605 if (!response.ok) {
9552295606 core.debug(`Cache not found for version ${request.version} of keys: ${keys.join(', ')}`);
9552395607 return undefined;
@@ -95552,8 +95636,10 @@ function restoreCacheV2(paths_1, primaryKey_1, restoreKeys_1, options_1) {
9555295636 throw error;
9555395637 }
9555495638 else {
95555- // Supress all non-validation cache related errors because caching should be optional
95556- // Log server errors (5xx) as errors, all other errors as warnings
95639+ // Suppress all non-validation cache related errors because caching should be optional
95640+ // Log server errors (5xx) as errors, all other errors as warnings.
95641+ // A read denied by policy (CacheReadDeniedError) is not an HttpClientError
95642+ // so it falls here and is warned, treated as a cache miss.
9555795643 if (typedError instanceof HttpClientError &&
9555895644 typeof typedError.statusCode === 'number' &&
9555995645 typedError.statusCode >= 500) {
@@ -95592,6 +95678,12 @@ function cache_saveCache(paths_1, key_1, options_1) {
9559295678 core_debug(`Cache service version: ${cacheServiceVersion}`);
9559395679 checkPaths(paths);
9559495680 checkKey(key);
95681+ const cacheMode = config_getCacheMode();
95682+ if (!isCacheWritable(cacheMode)) {
95683+ info(`Cache save skipped: the effective cache-mode '${cacheMode}' does not permit writes.`);
95684+ core_debug(`Skipped save for paths [${paths.join(', ')}] with key '${key}'.`);
95685+ return -1;
95686+ }
9559595687 switch (cacheServiceVersion) {
9559695688 case 'v2':
9559795689 return yield saveCacheV2(paths, key, options, enableCrossOsArchive);
@@ -95669,17 +95761,14 @@ function saveCacheV1(paths_1, key_1, options_1) {
9566995761 if (typedError.name === ValidationError.name) {
9567095762 throw error;
9567195763 }
95672- else if (typedError.name === CacheWriteDeniedError.name) {
95673- // Cache write was denied by policy (read-only token). Surface to the
95674- // customer at warning level so it is visible in the workflow log
95675- // without failing the run.
95676- warning(`Failed to save: ${typedError.message}`);
95677- }
9567895764 else if (typedError.name === ReserveCacheError.name) {
9567995765 info(`Failed to save: ${typedError.message}`);
9568095766 }
9568195767 else {
95682- // Log server errors (5xx) as errors, all other errors as warnings
95768+ // Log server errors (5xx) as errors, all other errors as warnings.
95769+ // A write denied by policy (CacheWriteDeniedError) is not an
95770+ // HttpClientError and its name does not match the ReserveCacheError arm,
95771+ // so it falls here and is warned without failing the run.
9568395772 if (typedError instanceof lib_HttpClientError &&
9568495773 typeof typedError.statusCode === 'number' &&
9568595774 typedError.statusCode >= 500) {
@@ -95790,20 +95879,17 @@ function saveCacheV2(paths_1, key_1, options_1) {
9579095879 if (typedError.name === ValidationError.name) {
9579195880 throw error;
9579295881 }
95793- else if (typedError.name === CacheWriteDeniedError.name) {
95794- // Cache write was denied by policy (read-only token). Surface to the
95795- // customer at warning level so it is visible in the workflow log
95796- // without failing the run.
95797- warning(`Failed to save: ${typedError.message}`);
95798- }
9579995882 else if (typedError.name === ReserveCacheError.name) {
9580095883 info(`Failed to save: ${typedError.message}`);
9580195884 }
9580295885 else if (typedError.name === FinalizeCacheError.name) {
9580395886 warning(typedError.message);
9580495887 }
9580595888 else {
95806- // Log server errors (5xx) as errors, all other errors as warnings
95889+ // Log server errors (5xx) as errors, all other errors as warnings.
95890+ // A write denied by policy (CacheWriteDeniedError) is not an
95891+ // HttpClientError and its name does not match the ReserveCacheError arm,
95892+ // so it falls here and is warned without failing the run.
9580795893 if (typedError instanceof lib_HttpClientError &&
9580895894 typeof typedError.statusCode === 'number' &&
9580995895 typedError.statusCode >= 500) {
0 commit comments