mirror of
https://github.com/actions/cache.git
synced 2026-06-27 16:55:20 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| caa2961268 | |||
| 00c2da95da |
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/cache"
|
name: "@actions/cache"
|
||||||
version: 5.0.5
|
version: 5.1.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions cache lib
|
summary: Actions cache lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
||||||
|
|||||||
@@ -109,6 +109,14 @@ The cache is scoped to the key, [version](#cache-version), and branch. The defau
|
|||||||
|
|
||||||
See [Matching a cache key](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key) for more info.
|
See [Matching a cache key](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key) for more info.
|
||||||
|
|
||||||
|
### Read-only access
|
||||||
|
|
||||||
|
Some workflow runs only have read-only access to the cache. A common case is a workflow triggered by a pull request from a fork: such runs can **restore** existing caches but may not be permitted to **save** new ones.
|
||||||
|
|
||||||
|
When the cache token is read-only, the save step does not fail the job. Instead, `@actions/cache` reports the denial once as a warning (for example, `Failed to save: ... cache write denied: ...`) and the step completes successfully without writing a cache entry. Restores in the same run continue to work as usual.
|
||||||
|
|
||||||
|
> **Note** This applies to the action's normal save path as well as the standalone [Save action](./save/README.md). If you intentionally want a restore-only setup, see [Make cache read only / Reuse cache from centralized job](./caching-strategies.md#make-cache-read-only--reuse-cache-from-centralized-job).
|
||||||
|
|
||||||
### Example cache workflow
|
### Example cache workflow
|
||||||
|
|
||||||
#### Restoring and saving cache using a single action
|
#### Restoring and saving cache using a single action
|
||||||
|
|||||||
@@ -25,6 +25,11 @@
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 5.1.0
|
||||||
|
|
||||||
|
- Bump `@actions/cache` to v5.1.0 to pick up [actions/toolkit#2435 Handle cache write error due to read-only token](https://github.com/actions/toolkit/pull/2435)
|
||||||
|
- Switch redundant "Cache save failed" warning to debug log in save-only
|
||||||
|
|
||||||
### 5.0.4
|
### 5.0.4
|
||||||
|
|
||||||
- Bump `minimatch` to v3.1.5 (fixes ReDoS via globstar patterns)
|
- Bump `minimatch` to v3.1.5 (fixes ReDoS via globstar patterns)
|
||||||
|
|||||||
@@ -105,8 +105,10 @@ test("save with valid inputs uploads a cache", async () => {
|
|||||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("save failing logs the warning message", async () => {
|
test("save failing logs the debug message", async () => {
|
||||||
|
const debugMock = jest.spyOn(core, "debug");
|
||||||
const warningMock = jest.spyOn(core, "warning");
|
const warningMock = jest.spyOn(core, "warning");
|
||||||
|
const failedMock = jest.spyOn(core, "setFailed");
|
||||||
|
|
||||||
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
|
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
|
||||||
|
|
||||||
@@ -115,6 +117,9 @@ test("save failing logs the warning message", async () => {
|
|||||||
testUtils.setInput(Inputs.Path, inputPath);
|
testUtils.setInput(Inputs.Path, inputPath);
|
||||||
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
|
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
|
||||||
|
|
||||||
|
// A read-only / write-denied save surfaces to the action as saveCache resolving
|
||||||
|
// to -1; the toolkit has already logged the underlying reason. The action
|
||||||
|
// must not fail the job or emit its own warning.
|
||||||
const cacheId = -1;
|
const cacheId = -1;
|
||||||
const saveCacheMock = jest
|
const saveCacheMock = jest
|
||||||
.spyOn(cache, "saveCache")
|
.spyOn(cache, "saveCache")
|
||||||
@@ -134,6 +139,7 @@ test("save failing logs the warning message", async () => {
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(warningMock).toHaveBeenCalledTimes(1);
|
expect(debugMock).toHaveBeenCalledWith("Cache was not saved.");
|
||||||
expect(warningMock).toHaveBeenCalledWith("Cache save failed.");
|
expect(warningMock).not.toHaveBeenCalled();
|
||||||
|
expect(failedMock).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
+43
-4
@@ -49,7 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.FinalizeCacheError = exports.ReserveCacheError = exports.ValidationError = void 0;
|
exports.FinalizeCacheError = exports.CacheWriteDeniedError = exports.CACHE_WRITE_DENIED_PREFIX = exports.ReserveCacheError = exports.ValidationError = void 0;
|
||||||
exports.isFeatureAvailable = isFeatureAvailable;
|
exports.isFeatureAvailable = isFeatureAvailable;
|
||||||
exports.restoreCache = restoreCache;
|
exports.restoreCache = restoreCache;
|
||||||
exports.saveCache = saveCache;
|
exports.saveCache = saveCache;
|
||||||
@@ -77,6 +77,26 @@ class ReserveCacheError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ReserveCacheError = ReserveCacheError;
|
exports.ReserveCacheError = ReserveCacheError;
|
||||||
|
/**
|
||||||
|
* Stable prefix used by the cache receiver to signal that the token has
|
||||||
|
* no writable scopes (read-only cache policy). Consumers can match on
|
||||||
|
* this prefix to distinguish policy denials from ordinary contention.
|
||||||
|
*/
|
||||||
|
exports.CACHE_WRITE_DENIED_PREFIX = 'cache write denied:';
|
||||||
|
/**
|
||||||
|
* Extends ReserveCacheError for source-compatibility: existing
|
||||||
|
* `instanceof ReserveCacheError` checks and `typedError.name ===
|
||||||
|
* ReserveCacheError.name` paths keep working, while consumers that want to
|
||||||
|
* distinguish a policy denial can check for CacheWriteDeniedError.name.
|
||||||
|
*/
|
||||||
|
class CacheWriteDeniedError extends ReserveCacheError {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'CacheWriteDeniedError';
|
||||||
|
Object.setPrototypeOf(this, CacheWriteDeniedError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheWriteDeniedError = CacheWriteDeniedError;
|
||||||
class FinalizeCacheError extends Error {
|
class FinalizeCacheError extends Error {
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
super(message);
|
super(message);
|
||||||
@@ -387,7 +407,11 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
|
const detailMessage = (_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message;
|
||||||
|
if (detailMessage === null || detailMessage === void 0 ? void 0 : detailMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${detailMessage}`);
|
||||||
|
}
|
||||||
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${detailMessage}`);
|
||||||
}
|
}
|
||||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
||||||
@@ -397,6 +421,9 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -435,6 +462,7 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
*/
|
*/
|
||||||
function saveCacheV2(paths_1, key_1, options_1) {
|
function saveCacheV2(paths_1, key_1, options_1) {
|
||||||
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
var _a;
|
||||||
// Override UploadOptions to force the use of Azure
|
// Override UploadOptions to force the use of Azure
|
||||||
// ...options goes first because we want to override the default values
|
// ...options goes first because we want to override the default values
|
||||||
// set in UploadOptions with these specific figures
|
// set in UploadOptions with these specific figures
|
||||||
@@ -470,7 +498,11 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
try {
|
try {
|
||||||
const response = yield twirpClient.CreateCacheEntry(request);
|
const response = yield twirpClient.CreateCacheEntry(request);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
if (response.message) {
|
// Skip the redundant inner warning when the receiver signalled a
|
||||||
|
// policy denial: the outer catch arm below will log a single
|
||||||
|
// customer-facing warning.
|
||||||
|
if (response.message &&
|
||||||
|
!response.message.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
core.warning(`Cache reservation failed: ${response.message}`);
|
core.warning(`Cache reservation failed: ${response.message}`);
|
||||||
}
|
}
|
||||||
throw new Error(response.message || 'Response was not ok');
|
throw new Error(response.message || 'Response was not ok');
|
||||||
@@ -479,6 +511,10 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.debug(`Failed to reserve cache: ${error}`);
|
core.debug(`Failed to reserve cache: ${error}`);
|
||||||
|
const errorMessage = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
|
||||||
|
if (errorMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${errorMessage}`);
|
||||||
|
}
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||||
}
|
}
|
||||||
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
||||||
@@ -503,6 +539,9 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -87527,7 +87566,7 @@ function randomUUID() {
|
|||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.0.5","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","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"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.1.0","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","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"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|||||||
Vendored
+43
-4
@@ -49,7 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.FinalizeCacheError = exports.ReserveCacheError = exports.ValidationError = void 0;
|
exports.FinalizeCacheError = exports.CacheWriteDeniedError = exports.CACHE_WRITE_DENIED_PREFIX = exports.ReserveCacheError = exports.ValidationError = void 0;
|
||||||
exports.isFeatureAvailable = isFeatureAvailable;
|
exports.isFeatureAvailable = isFeatureAvailable;
|
||||||
exports.restoreCache = restoreCache;
|
exports.restoreCache = restoreCache;
|
||||||
exports.saveCache = saveCache;
|
exports.saveCache = saveCache;
|
||||||
@@ -77,6 +77,26 @@ class ReserveCacheError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ReserveCacheError = ReserveCacheError;
|
exports.ReserveCacheError = ReserveCacheError;
|
||||||
|
/**
|
||||||
|
* Stable prefix used by the cache receiver to signal that the token has
|
||||||
|
* no writable scopes (read-only cache policy). Consumers can match on
|
||||||
|
* this prefix to distinguish policy denials from ordinary contention.
|
||||||
|
*/
|
||||||
|
exports.CACHE_WRITE_DENIED_PREFIX = 'cache write denied:';
|
||||||
|
/**
|
||||||
|
* Extends ReserveCacheError for source-compatibility: existing
|
||||||
|
* `instanceof ReserveCacheError` checks and `typedError.name ===
|
||||||
|
* ReserveCacheError.name` paths keep working, while consumers that want to
|
||||||
|
* distinguish a policy denial can check for CacheWriteDeniedError.name.
|
||||||
|
*/
|
||||||
|
class CacheWriteDeniedError extends ReserveCacheError {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'CacheWriteDeniedError';
|
||||||
|
Object.setPrototypeOf(this, CacheWriteDeniedError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheWriteDeniedError = CacheWriteDeniedError;
|
||||||
class FinalizeCacheError extends Error {
|
class FinalizeCacheError extends Error {
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
super(message);
|
super(message);
|
||||||
@@ -387,7 +407,11 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
|
const detailMessage = (_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message;
|
||||||
|
if (detailMessage === null || detailMessage === void 0 ? void 0 : detailMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${detailMessage}`);
|
||||||
|
}
|
||||||
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${detailMessage}`);
|
||||||
}
|
}
|
||||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
||||||
@@ -397,6 +421,9 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -435,6 +462,7 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
*/
|
*/
|
||||||
function saveCacheV2(paths_1, key_1, options_1) {
|
function saveCacheV2(paths_1, key_1, options_1) {
|
||||||
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
var _a;
|
||||||
// Override UploadOptions to force the use of Azure
|
// Override UploadOptions to force the use of Azure
|
||||||
// ...options goes first because we want to override the default values
|
// ...options goes first because we want to override the default values
|
||||||
// set in UploadOptions with these specific figures
|
// set in UploadOptions with these specific figures
|
||||||
@@ -470,7 +498,11 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
try {
|
try {
|
||||||
const response = yield twirpClient.CreateCacheEntry(request);
|
const response = yield twirpClient.CreateCacheEntry(request);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
if (response.message) {
|
// Skip the redundant inner warning when the receiver signalled a
|
||||||
|
// policy denial: the outer catch arm below will log a single
|
||||||
|
// customer-facing warning.
|
||||||
|
if (response.message &&
|
||||||
|
!response.message.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
core.warning(`Cache reservation failed: ${response.message}`);
|
core.warning(`Cache reservation failed: ${response.message}`);
|
||||||
}
|
}
|
||||||
throw new Error(response.message || 'Response was not ok');
|
throw new Error(response.message || 'Response was not ok');
|
||||||
@@ -479,6 +511,10 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.debug(`Failed to reserve cache: ${error}`);
|
core.debug(`Failed to reserve cache: ${error}`);
|
||||||
|
const errorMessage = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
|
||||||
|
if (errorMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${errorMessage}`);
|
||||||
|
}
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||||
}
|
}
|
||||||
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
||||||
@@ -503,6 +539,9 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -87527,7 +87566,7 @@ function randomUUID() {
|
|||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.0.5","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","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"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.1.0","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","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"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|||||||
Vendored
+48
-5
@@ -49,7 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.FinalizeCacheError = exports.ReserveCacheError = exports.ValidationError = void 0;
|
exports.FinalizeCacheError = exports.CacheWriteDeniedError = exports.CACHE_WRITE_DENIED_PREFIX = exports.ReserveCacheError = exports.ValidationError = void 0;
|
||||||
exports.isFeatureAvailable = isFeatureAvailable;
|
exports.isFeatureAvailable = isFeatureAvailable;
|
||||||
exports.restoreCache = restoreCache;
|
exports.restoreCache = restoreCache;
|
||||||
exports.saveCache = saveCache;
|
exports.saveCache = saveCache;
|
||||||
@@ -77,6 +77,26 @@ class ReserveCacheError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ReserveCacheError = ReserveCacheError;
|
exports.ReserveCacheError = ReserveCacheError;
|
||||||
|
/**
|
||||||
|
* Stable prefix used by the cache receiver to signal that the token has
|
||||||
|
* no writable scopes (read-only cache policy). Consumers can match on
|
||||||
|
* this prefix to distinguish policy denials from ordinary contention.
|
||||||
|
*/
|
||||||
|
exports.CACHE_WRITE_DENIED_PREFIX = 'cache write denied:';
|
||||||
|
/**
|
||||||
|
* Extends ReserveCacheError for source-compatibility: existing
|
||||||
|
* `instanceof ReserveCacheError` checks and `typedError.name ===
|
||||||
|
* ReserveCacheError.name` paths keep working, while consumers that want to
|
||||||
|
* distinguish a policy denial can check for CacheWriteDeniedError.name.
|
||||||
|
*/
|
||||||
|
class CacheWriteDeniedError extends ReserveCacheError {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'CacheWriteDeniedError';
|
||||||
|
Object.setPrototypeOf(this, CacheWriteDeniedError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheWriteDeniedError = CacheWriteDeniedError;
|
||||||
class FinalizeCacheError extends Error {
|
class FinalizeCacheError extends Error {
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
super(message);
|
super(message);
|
||||||
@@ -387,7 +407,11 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
|
const detailMessage = (_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message;
|
||||||
|
if (detailMessage === null || detailMessage === void 0 ? void 0 : detailMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${detailMessage}`);
|
||||||
|
}
|
||||||
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${detailMessage}`);
|
||||||
}
|
}
|
||||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
||||||
@@ -397,6 +421,9 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -435,6 +462,7 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
*/
|
*/
|
||||||
function saveCacheV2(paths_1, key_1, options_1) {
|
function saveCacheV2(paths_1, key_1, options_1) {
|
||||||
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
var _a;
|
||||||
// Override UploadOptions to force the use of Azure
|
// Override UploadOptions to force the use of Azure
|
||||||
// ...options goes first because we want to override the default values
|
// ...options goes first because we want to override the default values
|
||||||
// set in UploadOptions with these specific figures
|
// set in UploadOptions with these specific figures
|
||||||
@@ -470,7 +498,11 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
try {
|
try {
|
||||||
const response = yield twirpClient.CreateCacheEntry(request);
|
const response = yield twirpClient.CreateCacheEntry(request);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
if (response.message) {
|
// Skip the redundant inner warning when the receiver signalled a
|
||||||
|
// policy denial: the outer catch arm below will log a single
|
||||||
|
// customer-facing warning.
|
||||||
|
if (response.message &&
|
||||||
|
!response.message.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
core.warning(`Cache reservation failed: ${response.message}`);
|
core.warning(`Cache reservation failed: ${response.message}`);
|
||||||
}
|
}
|
||||||
throw new Error(response.message || 'Response was not ok');
|
throw new Error(response.message || 'Response was not ok');
|
||||||
@@ -479,6 +511,10 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.debug(`Failed to reserve cache: ${error}`);
|
core.debug(`Failed to reserve cache: ${error}`);
|
||||||
|
const errorMessage = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
|
||||||
|
if (errorMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${errorMessage}`);
|
||||||
|
}
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||||
}
|
}
|
||||||
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
||||||
@@ -503,6 +539,9 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -46436,7 +46475,11 @@ function saveOnlyRun(earlyExit) {
|
|||||||
try {
|
try {
|
||||||
const cacheId = yield saveImpl(new stateProvider_1.NullStateProvider());
|
const cacheId = yield saveImpl(new stateProvider_1.NullStateProvider());
|
||||||
if (cacheId === -1) {
|
if (cacheId === -1) {
|
||||||
core.warning(`Cache save failed.`);
|
// The toolkit's saveCache already logs the underlying reason at
|
||||||
|
// the appropriate severity (warning for most failures, info for
|
||||||
|
// benign concurrency races, error for 5xx). Avoid emitting a
|
||||||
|
// generic warning here that would duplicate or mask that signal.
|
||||||
|
core.debug(`Cache was not saved.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -87540,7 +87583,7 @@ function randomUUID() {
|
|||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.0.5","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","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"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.1.0","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","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"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|||||||
Vendored
+48
-5
@@ -49,7 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.FinalizeCacheError = exports.ReserveCacheError = exports.ValidationError = void 0;
|
exports.FinalizeCacheError = exports.CacheWriteDeniedError = exports.CACHE_WRITE_DENIED_PREFIX = exports.ReserveCacheError = exports.ValidationError = void 0;
|
||||||
exports.isFeatureAvailable = isFeatureAvailable;
|
exports.isFeatureAvailable = isFeatureAvailable;
|
||||||
exports.restoreCache = restoreCache;
|
exports.restoreCache = restoreCache;
|
||||||
exports.saveCache = saveCache;
|
exports.saveCache = saveCache;
|
||||||
@@ -77,6 +77,26 @@ class ReserveCacheError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ReserveCacheError = ReserveCacheError;
|
exports.ReserveCacheError = ReserveCacheError;
|
||||||
|
/**
|
||||||
|
* Stable prefix used by the cache receiver to signal that the token has
|
||||||
|
* no writable scopes (read-only cache policy). Consumers can match on
|
||||||
|
* this prefix to distinguish policy denials from ordinary contention.
|
||||||
|
*/
|
||||||
|
exports.CACHE_WRITE_DENIED_PREFIX = 'cache write denied:';
|
||||||
|
/**
|
||||||
|
* Extends ReserveCacheError for source-compatibility: existing
|
||||||
|
* `instanceof ReserveCacheError` checks and `typedError.name ===
|
||||||
|
* ReserveCacheError.name` paths keep working, while consumers that want to
|
||||||
|
* distinguish a policy denial can check for CacheWriteDeniedError.name.
|
||||||
|
*/
|
||||||
|
class CacheWriteDeniedError extends ReserveCacheError {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'CacheWriteDeniedError';
|
||||||
|
Object.setPrototypeOf(this, CacheWriteDeniedError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheWriteDeniedError = CacheWriteDeniedError;
|
||||||
class FinalizeCacheError extends Error {
|
class FinalizeCacheError extends Error {
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
super(message);
|
super(message);
|
||||||
@@ -387,7 +407,11 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
|
const detailMessage = (_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message;
|
||||||
|
if (detailMessage === null || detailMessage === void 0 ? void 0 : detailMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${detailMessage}`);
|
||||||
|
}
|
||||||
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${detailMessage}`);
|
||||||
}
|
}
|
||||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
||||||
@@ -397,6 +421,9 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -435,6 +462,7 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
*/
|
*/
|
||||||
function saveCacheV2(paths_1, key_1, options_1) {
|
function saveCacheV2(paths_1, key_1, options_1) {
|
||||||
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
var _a;
|
||||||
// Override UploadOptions to force the use of Azure
|
// Override UploadOptions to force the use of Azure
|
||||||
// ...options goes first because we want to override the default values
|
// ...options goes first because we want to override the default values
|
||||||
// set in UploadOptions with these specific figures
|
// set in UploadOptions with these specific figures
|
||||||
@@ -470,7 +498,11 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
try {
|
try {
|
||||||
const response = yield twirpClient.CreateCacheEntry(request);
|
const response = yield twirpClient.CreateCacheEntry(request);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
if (response.message) {
|
// Skip the redundant inner warning when the receiver signalled a
|
||||||
|
// policy denial: the outer catch arm below will log a single
|
||||||
|
// customer-facing warning.
|
||||||
|
if (response.message &&
|
||||||
|
!response.message.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
core.warning(`Cache reservation failed: ${response.message}`);
|
core.warning(`Cache reservation failed: ${response.message}`);
|
||||||
}
|
}
|
||||||
throw new Error(response.message || 'Response was not ok');
|
throw new Error(response.message || 'Response was not ok');
|
||||||
@@ -479,6 +511,10 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.debug(`Failed to reserve cache: ${error}`);
|
core.debug(`Failed to reserve cache: ${error}`);
|
||||||
|
const errorMessage = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
|
||||||
|
if (errorMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${errorMessage}`);
|
||||||
|
}
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||||
}
|
}
|
||||||
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
||||||
@@ -503,6 +539,9 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -46436,7 +46475,11 @@ function saveOnlyRun(earlyExit) {
|
|||||||
try {
|
try {
|
||||||
const cacheId = yield saveImpl(new stateProvider_1.NullStateProvider());
|
const cacheId = yield saveImpl(new stateProvider_1.NullStateProvider());
|
||||||
if (cacheId === -1) {
|
if (cacheId === -1) {
|
||||||
core.warning(`Cache save failed.`);
|
// The toolkit's saveCache already logs the underlying reason at
|
||||||
|
// the appropriate severity (warning for most failures, info for
|
||||||
|
// benign concurrency races, error for 5xx). Avoid emitting a
|
||||||
|
// generic warning here that would duplicate or mask that signal.
|
||||||
|
core.debug(`Cache was not saved.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -87540,7 +87583,7 @@ function randomUUID() {
|
|||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.0.5","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","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"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.1.0","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","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"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|||||||
Generated
+21
-34
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "5.0.4",
|
"version": "5.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "5.0.4",
|
"version": "5.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^5.0.5",
|
"@actions/cache": "^5.1.0",
|
||||||
"@actions/core": "^2.0.3",
|
"@actions/core": "^2.0.3",
|
||||||
"@actions/exec": "^2.0.0",
|
"@actions/exec": "^2.0.0",
|
||||||
"@actions/io": "^2.0.0"
|
"@actions/io": "^2.0.0"
|
||||||
@@ -39,9 +39,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache": {
|
"node_modules/@actions/cache": {
|
||||||
"version": "5.0.5",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-5.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-5.1.0.tgz",
|
||||||
"integrity": "sha512-jiQSg0gfd+C2KPgcmdCOq7dCuCIQQWQ4b1YfGIRaaA9w7PJbRwTOcCz4LiFEUnqZGf0ha/8OKL3BeNwetHzYsQ==",
|
"integrity": "sha512-kTIj4YPrjjRPKSGlj7f8eq+Pijoy/SKBEbJcAwNsQTFGEF29NGqj1mqD02/PmhV6r4bRAixycexAWpmUJ2aCwg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^2.0.0",
|
"@actions/core": "^2.0.0",
|
||||||
@@ -1453,18 +1453,6 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@nodable/entities": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/nodable"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@nodelib/fs.scandir": {
|
"node_modules/@nodelib/fs.scandir": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||||
@@ -3754,9 +3742,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-builder": {
|
"node_modules/fast-xml-builder": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.4.tgz",
|
||||||
"integrity": "sha512-4TJn/8FKLeslLAH3dnohXqE3QSoxkhvaMzepOIZytwJXZO69Bfz0HBdDHzOTOon6G59Zrk6VQ2bEiv1t61rfkA==",
|
"integrity": "sha512-f2jhpN4Eccy0/Uz9csxh3Nu6q4ErKxf0XIsasomfOihuSUa3/xw6w8dnOtCDgEItQFJG8KyXPzQXzcODDrrbOg==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -3769,9 +3757,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-parser": {
|
"node_modules/fast-xml-parser": {
|
||||||
"version": "5.7.1",
|
"version": "5.5.6",
|
||||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.6.tgz",
|
||||||
"integrity": "sha512-8Cc3f8GUGUULg34pBch/KGyPLglS+OFs05deyOlY7fL2MTagYPKrVQNmR1fLF/yJ9PH5ZSTd3YDF6pnmeZU+zA==",
|
"integrity": "sha512-3+fdZyBRVg29n4rXP0joHthhcHdPUHaIC16cuyyd1iLsuaO6Vea36MPrxgAzbZna8lhvZeRL8Bc9GP56/J9xEw==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -3780,10 +3768,9 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nodable/entities": "^2.1.0",
|
"fast-xml-builder": "^1.1.4",
|
||||||
"fast-xml-builder": "^1.1.5",
|
"path-expression-matcher": "^1.1.3",
|
||||||
"path-expression-matcher": "^1.5.0",
|
"strnum": "^2.1.2"
|
||||||
"strnum": "^2.2.3"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"fxparser": "src/cli/cli.js"
|
"fxparser": "src/cli/cli.js"
|
||||||
@@ -6172,9 +6159,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/path-expression-matcher": {
|
"node_modules/path-expression-matcher": {
|
||||||
"version": "1.5.0",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.1.3.tgz",
|
||||||
"integrity": "sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ==",
|
"integrity": "sha512-qdVgY8KXmVdJZRSS1JdEPOKPdTiEK/pi0RkcT2sw1RhXxohdujUlJFPuS1TSkevZ9vzd3ZlL7ULl1MHGTApKzQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -7084,9 +7071,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/strnum": {
|
"node_modules/strnum": {
|
||||||
"version": "2.2.3",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.2.tgz",
|
||||||
"integrity": "sha512-oKx6RUCuHfT3oyVjtnrmn19H1SiCqgJSg+54XqURKp5aCMbrXrhLjRN9TjuwMjiYstZ0MzDrHqkGZ5dFTKd+zg==",
|
"integrity": "sha512-l63NF9y/cLROq/yqKXSLtcMeeyOfnSQlfMSlzFt/K73oIaD8DGaQWd7Z34X9GPiKqP5rbSh84Hl4bOlLcjiSrQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "5.0.4",
|
"version": "5.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Cache dependencies and build outputs",
|
"description": "Cache dependencies and build outputs",
|
||||||
"main": "dist/restore/index.js",
|
"main": "dist/restore/index.js",
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^5.0.5",
|
"@actions/cache": "^5.1.0",
|
||||||
"@actions/core": "^2.0.3",
|
"@actions/core": "^2.0.3",
|
||||||
"@actions/exec": "^2.0.0",
|
"@actions/exec": "^2.0.0",
|
||||||
"@actions/io": "^2.0.0"
|
"@actions/io": "^2.0.0"
|
||||||
|
|||||||
+5
-1
@@ -84,7 +84,11 @@ export async function saveOnlyRun(
|
|||||||
try {
|
try {
|
||||||
const cacheId = await saveImpl(new NullStateProvider());
|
const cacheId = await saveImpl(new NullStateProvider());
|
||||||
if (cacheId === -1) {
|
if (cacheId === -1) {
|
||||||
core.warning(`Cache save failed.`);
|
// The toolkit's saveCache already logs the underlying reason at
|
||||||
|
// the appropriate severity (warning for most failures, info for
|
||||||
|
// benign concurrency races, error for 5xx). Avoid emitting a
|
||||||
|
// generic warning here that would duplicate or mask that signal.
|
||||||
|
core.debug(`Cache was not saved.`);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user