pull/1689/merge
Stephen Hodgson 3 days ago committed by GitHub
commit a975f6a8e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -33,7 +33,7 @@ If you do not upgrade, all workflow runs using any of the deprecated [actions/ca
Upgrading to the recommended versions will not break your workflows.
> **Additionally, if you are managing your own GitHub runners, you must update your runner version to `2.231.0` or newer to ensure compatibility with the new cache service.**
> **Additionally, if you are managing your own GitHub runners, you must update your runner version to `2.231.0` or newer to ensure compatibility with the new cache service.**
> Failure to update both the action version and your runner version may result in workflow failures after the migration date.
Read more about the change & access the migration guide: [reference to the announcement](https://github.com/actions/cache/discussions/1510).
@ -87,6 +87,7 @@ If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are requir
* `key` - An explicit key for a cache entry. See [creating a cache key](#creating-a-cache-key).
* `path` - A list of files, directories, and wildcard patterns to cache and restore. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns.
* `restore-keys` - An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key.
* `compression-level` - Compression level to use when creating cache archives (applies to the save step of the cache action). Use `0` for no compression and `9` for maximum compression. Defaults to the compression tool's standard level when unset.
* `enableCrossOsArchive` - An optional boolean when enabled, allows Windows runners to save or restore caches that can be restored or saved respectively on other platforms. Default: `false`
* `fail-on-cache-miss` - Fail the workflow if cache entry is not found. Default: `false`
* `lookup-only` - If true, only checks if cache entry exists and skips download. Does not change save cache behavior. Default: `false`
@ -351,7 +352,7 @@ Please note that Windows environment variables (like `%LocalAppData%`) will NOT
## Note
Thank you for your interest in this GitHub repo, however, right now we are not taking contributions.
Thank you for your interest in this GitHub repo, however, right now we are not taking contributions.
We continue to focus our resources on strategic areas that help our customers be successful while making developers' lives easier. While GitHub Actions remains a key part of this vision, we are allocating resources towards other areas of Actions and are not taking contributions to this repository at this time. The GitHub public roadmap is the best place to follow along for any updates on features were working on and what stage theyre in.
@ -359,7 +360,7 @@ We are taking the following steps to better direct requests related to GitHub Ac
1. We will be directing questions and support requests to our [Community Discussions area](https://github.com/orgs/community/discussions/categories/actions)
2. High Priority bugs can be reported through Community Discussions or you can report these to our support team https://support.github.com/contact/bug-report.
2. High Priority bugs can be reported through Community Discussions or you can report these to our support team <https://support.github.com/contact/bug-report>.
3. Security Issues should be handled as per our [security.md](SECURITY.md).
@ -369,4 +370,4 @@ You are welcome to still raise bugs in this repo.
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
The scripts and documentation in this project are released under the [MIT License](LICENSE)

@ -1,5 +1,6 @@
import * as cache from "@actions/cache";
import * as core from "@actions/core";
import * as zlib from "zlib";
import { Events, RefKey } from "../src/constants";
import * as actionUtils from "../src/utils/actionUtils";
@ -24,6 +25,11 @@ beforeEach(() => {
delete process.env[RefKey];
});
afterEach(() => {
delete process.env["ZSTD_CLEVEL"];
delete process.env["GZIP"];
});
afterAll(() => {
process.env = pristineEnv;
});
@ -177,6 +183,61 @@ test("getInputAsInt returns undefined if input is invalid or NaN", () => {
expect(actionUtils.getInputAsInt("foo")).toBeUndefined();
});
test("getCompressionLevel returns undefined if input not set", () => {
expect(actionUtils.getCompressionLevel("undefined")).toBeUndefined();
});
test("getCompressionLevel returns value if input is valid", () => {
testUtils.setInput("foo", "9");
expect(actionUtils.getCompressionLevel("foo")).toBe(9);
});
test("getCompressionLevel allows zero for no compression", () => {
testUtils.setInput("foo", "0");
expect(actionUtils.getCompressionLevel("foo")).toBe(0);
});
test("getCompressionLevel returns undefined and warns for negative values", () => {
const infoMock = jest.spyOn(core, "info");
testUtils.setInput("foo", "-3");
expect(actionUtils.getCompressionLevel("foo")).toBeUndefined();
expect(infoMock).toHaveBeenCalledWith(
"[warning]Invalid compression-level provided: -3. Expected a value between 0 (no compression) and 9 (maximum compression)."
);
});
test("getCompressionLevel returns undefined and warns if input is too large", () => {
const infoMock = jest.spyOn(core, "info");
testUtils.setInput("foo", "11");
expect(actionUtils.getCompressionLevel("foo")).toBeUndefined();
expect(infoMock).toHaveBeenCalledWith(
"[warning]Invalid compression-level provided: 11. Expected a value between 0 (no compression) and 9 (maximum compression)."
);
});
test("setCompressionLevel sets compression env vars", () => {
actionUtils.setCompressionLevel(7);
expect(process.env["ZSTD_CLEVEL"]).toBe("7");
expect(process.env["GZIP"]).toBe("-7");
});
test("setCompressionLevel sets no-compression flag when zero", () => {
actionUtils.setCompressionLevel(0);
expect(process.env["ZSTD_CLEVEL"]).toBe("0");
expect(process.env["GZIP"]).toBe("-0");
});
test("higher compression level produces smaller gzip output", () => {
const data = Buffer.alloc(8 * 1024, "A");
const level0 = zlib.gzipSync(data, { level: 0 });
const level9 = zlib.gzipSync(data, { level: 9 });
expect(level0.byteLength).toBeGreaterThan(level9.byteLength);
expect(level0.byteLength - level9.byteLength).toBeGreaterThan(1000);
});
test("getInputAsInt throws if required and value missing", () => {
expect(() =>
actionUtils.getInputAsInt("undefined", { required: true })

@ -43,6 +43,22 @@ beforeAll(() => {
}
);
jest.spyOn(actionUtils, "getCompressionLevel").mockImplementation(
(name, options) => {
return jest
.requireActual("../src/utils/actionUtils")
.getCompressionLevel(name, options);
}
);
jest.spyOn(actionUtils, "setCompressionLevel").mockImplementation(
compressionLevel => {
return jest
.requireActual("../src/utils/actionUtils")
.setCompressionLevel(compressionLevel);
}
);
jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation(
(key, cacheResult) => {
return jest
@ -71,6 +87,8 @@ afterEach(() => {
testUtils.clearInputs();
delete process.env[Events.Key];
delete process.env[RefKey];
delete process.env["ZSTD_CLEVEL"];
delete process.env["GZIP"];
});
test("save with valid inputs uploads a cache", async () => {
@ -92,6 +110,7 @@ test("save with valid inputs uploads a cache", async () => {
const inputPath = "node_modules";
testUtils.setInput(Inputs.Path, inputPath);
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
testUtils.setInput(Inputs.CompressionLevel, "8");
const cacheId = 4;
const saveCacheMock = jest
@ -102,6 +121,60 @@ test("save with valid inputs uploads a cache", async () => {
await saveRun();
expect(process.env["ZSTD_CLEVEL"]).toBe("8");
expect(process.env["GZIP"]).toBe("-8");
expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
[inputPath],
primaryKey,
{
uploadChunkSize: 4000000
},
false
);
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("negative compression level leaves env unset in combined flow", async () => {
const failedMock = jest.spyOn(core, "setFailed");
const setCompressionLevelMock = jest.spyOn(
actionUtils,
"setCompressionLevel"
);
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
const savedCacheKey = "Linux-node-";
jest.spyOn(core, "getState")
// Cache Entry State
.mockImplementationOnce(() => {
return primaryKey;
})
// Cache Key State
.mockImplementationOnce(() => {
return savedCacheKey;
});
const inputPath = "node_modules";
testUtils.setInput(Inputs.Path, inputPath);
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
testUtils.setInput(Inputs.CompressionLevel, "-5");
const cacheId = 4;
const saveCacheMock = jest
.spyOn(cache, "saveCache")
.mockImplementationOnce(() => {
return Promise.resolve(cacheId);
});
await saveRun();
expect(process.env["ZSTD_CLEVEL"]).toBeUndefined();
expect(process.env["GZIP"]).toBeUndefined();
expect(setCompressionLevelMock).not.toHaveBeenCalled();
expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
[inputPath],

@ -40,6 +40,22 @@ beforeAll(() => {
}
);
jest.spyOn(actionUtils, "getCompressionLevel").mockImplementation(
(name, options) => {
return jest
.requireActual("../src/utils/actionUtils")
.getCompressionLevel(name, options);
}
);
jest.spyOn(actionUtils, "setCompressionLevel").mockImplementation(
compressionLevel => {
return jest
.requireActual("../src/utils/actionUtils")
.setCompressionLevel(compressionLevel);
}
);
jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation(
(key, cacheResult) => {
return jest
@ -69,6 +85,8 @@ afterEach(() => {
testUtils.clearInputs();
delete process.env[Events.Key];
delete process.env[RefKey];
delete process.env["ZSTD_CLEVEL"];
delete process.env["GZIP"];
});
test("save with invalid event outputs warning", async () => {
@ -406,3 +424,151 @@ test("save with valid inputs uploads a cache", async () => {
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("save applies compression level when provided", async () => {
const failedMock = jest.spyOn(core, "setFailed");
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
const savedCacheKey = "Linux-node-";
jest.spyOn(core, "getState")
// Cache Entry State
.mockImplementationOnce(() => {
return savedCacheKey;
})
// Cache Key State
.mockImplementationOnce(() => {
return primaryKey;
});
const inputPath = "node_modules";
testUtils.setInput(Inputs.Path, inputPath);
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
testUtils.setInput(Inputs.CompressionLevel, "9");
const cacheId = 4;
const saveCacheMock = jest
.spyOn(cache, "saveCache")
.mockImplementationOnce(() => {
return Promise.resolve(cacheId);
});
await saveImpl(new StateProvider());
expect(process.env["ZSTD_CLEVEL"]).toBe("9");
expect(process.env["GZIP"]).toBe("-9");
expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
[inputPath],
primaryKey,
{
uploadChunkSize: 4000000
},
false
);
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("save skips setting compression when value is out of range", async () => {
const failedMock = jest.spyOn(core, "setFailed");
const setCompressionLevelMock = jest.spyOn(
actionUtils,
"setCompressionLevel"
);
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
const savedCacheKey = "Linux-node-";
jest.spyOn(core, "getState")
// Cache Entry State
.mockImplementationOnce(() => {
return savedCacheKey;
})
// Cache Key State
.mockImplementationOnce(() => {
return primaryKey;
});
const inputPath = "node_modules";
testUtils.setInput(Inputs.Path, inputPath);
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
testUtils.setInput(Inputs.CompressionLevel, "99");
const cacheId = 4;
const saveCacheMock = jest
.spyOn(cache, "saveCache")
.mockImplementationOnce(() => {
return Promise.resolve(cacheId);
});
await saveImpl(new StateProvider());
expect(process.env["ZSTD_CLEVEL"]).toBeUndefined();
expect(process.env["GZIP"]).toBeUndefined();
expect(setCompressionLevelMock).not.toHaveBeenCalled();
expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
[inputPath],
primaryKey,
{
uploadChunkSize: 4000000
},
false
);
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("save skips setting compression when value is negative", async () => {
const failedMock = jest.spyOn(core, "setFailed");
const setCompressionLevelMock = jest.spyOn(
actionUtils,
"setCompressionLevel"
);
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
const savedCacheKey = "Linux-node-";
jest.spyOn(core, "getState")
// Cache Entry State
.mockImplementationOnce(() => {
return savedCacheKey;
})
// Cache Key State
.mockImplementationOnce(() => {
return primaryKey;
});
const inputPath = "node_modules";
testUtils.setInput(Inputs.Path, inputPath);
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
testUtils.setInput(Inputs.CompressionLevel, "-1");
const cacheId = 4;
const saveCacheMock = jest
.spyOn(cache, "saveCache")
.mockImplementationOnce(() => {
return Promise.resolve(cacheId);
});
await saveImpl(new StateProvider());
expect(process.env["ZSTD_CLEVEL"]).toBeUndefined();
expect(process.env["GZIP"]).toBeUndefined();
expect(setCompressionLevelMock).not.toHaveBeenCalled();
expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
[inputPath],
primaryKey,
{
uploadChunkSize: 4000000
},
false
);
expect(failedMock).toHaveBeenCalledTimes(0);
});

@ -43,6 +43,22 @@ beforeAll(() => {
}
);
jest.spyOn(actionUtils, "getCompressionLevel").mockImplementation(
(name, options) => {
return jest
.requireActual("../src/utils/actionUtils")
.getCompressionLevel(name, options);
}
);
jest.spyOn(actionUtils, "setCompressionLevel").mockImplementation(
compressionLevel => {
return jest
.requireActual("../src/utils/actionUtils")
.setCompressionLevel(compressionLevel);
}
);
jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation(
(key, cacheResult) => {
return jest
@ -71,6 +87,8 @@ afterEach(() => {
testUtils.clearInputs();
delete process.env[Events.Key];
delete process.env[RefKey];
delete process.env["ZSTD_CLEVEL"];
delete process.env["GZIP"];
});
test("save with valid inputs uploads a cache", async () => {
@ -82,6 +100,43 @@ test("save with valid inputs uploads a cache", async () => {
testUtils.setInput(Inputs.Key, primaryKey);
testUtils.setInput(Inputs.Path, inputPath);
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
testUtils.setInput(Inputs.CompressionLevel, "0");
const cacheId = 4;
const saveCacheMock = jest
.spyOn(cache, "saveCache")
.mockImplementationOnce(() => {
return Promise.resolve(cacheId);
});
await saveOnlyRun();
expect(process.env["ZSTD_CLEVEL"]).toBe("0");
expect(process.env["GZIP"]).toBe("-0");
expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
[inputPath],
primaryKey,
{
uploadChunkSize: 4000000
},
false
);
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("negative compression level does not set env vars", async () => {
const failedMock = jest.spyOn(core, "setFailed");
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
const inputPath = "node_modules";
testUtils.setInput(Inputs.Key, primaryKey);
testUtils.setInput(Inputs.Path, inputPath);
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
testUtils.setInput(Inputs.CompressionLevel, "-2");
const cacheId = 4;
const saveCacheMock = jest
@ -92,6 +147,9 @@ test("save with valid inputs uploads a cache", async () => {
await saveOnlyRun();
expect(process.env["ZSTD_CLEVEL"]).toBeUndefined();
expect(process.env["GZIP"]).toBeUndefined();
expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
[inputPath],

@ -14,6 +14,9 @@ inputs:
upload-chunk-size:
description: 'The chunk size used to split up large files during upload, in bytes'
required: false
compression-level:
description: 'Compression level used when creating cache archives (save step only). Set 0 for no compression and 9 for maximum compression. Defaults to the compression tool defaults when unset'
required: false
enableCrossOsArchive:
description: 'An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms'
default: 'false'

@ -44019,6 +44019,7 @@ var Inputs;
Inputs["Path"] = "path";
Inputs["RestoreKeys"] = "restore-keys";
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["CompressionLevel"] = "compression-level";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
@ -44312,6 +44313,8 @@ exports.logWarning = logWarning;
exports.isValidEvent = isValidEvent;
exports.getInputAsArray = getInputAsArray;
exports.getInputAsInt = getInputAsInt;
exports.getCompressionLevel = getCompressionLevel;
exports.setCompressionLevel = setCompressionLevel;
exports.getInputAsBool = getInputAsBool;
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
const cache = __importStar(__nccwpck_require__(5116));
@ -44354,6 +44357,25 @@ function getInputAsInt(name, options) {
}
return value;
}
function getCompressionLevel(name, options) {
const rawValue = core.getInput(name, options);
if (rawValue === "") {
return undefined;
}
const compressionLevel = parseInt(rawValue, 10);
if (isNaN(compressionLevel) ||
compressionLevel < 0 ||
compressionLevel > 9) {
logWarning(`Invalid compression-level provided: ${rawValue}. Expected a value between 0 (no compression) and 9 (maximum compression).`);
return undefined;
}
return compressionLevel;
}
function setCompressionLevel(compressionLevel) {
const level = compressionLevel.toString();
process.env["ZSTD_CLEVEL"] = level;
process.env["GZIP"] = `-${level}`;
}
function getInputAsBool(name, options) {
const result = core.getInput(name, options);
return result.toLowerCase() === "true";
@ -59264,6 +59286,24 @@ exports.UserDelegationKeyCredential = UserDelegationKeyCredential;
/***/ }),
/***/ 83627:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnownEncryptionAlgorithmType = void 0;
/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */
var KnownEncryptionAlgorithmType;
(function (KnownEncryptionAlgorithmType) {
KnownEncryptionAlgorithmType["AES256"] = "AES256";
})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {}));
//# sourceMappingURL=generatedModels.js.map
/***/ }),
/***/ 30247:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -69536,6 +69576,132 @@ exports.listType = {
/***/ }),
/***/ 56635:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=appendBlob.js.map
/***/ }),
/***/ 68355:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blob.js.map
/***/ }),
/***/ 17188:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blockBlob.js.map
/***/ }),
/***/ 15337:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=container.js.map
/***/ }),
/***/ 82354:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const tslib_1 = __nccwpck_require__(61860);
tslib_1.__exportStar(__nccwpck_require__(26865), exports);
tslib_1.__exportStar(__nccwpck_require__(15337), exports);
tslib_1.__exportStar(__nccwpck_require__(68355), exports);
tslib_1.__exportStar(__nccwpck_require__(14400), exports);
tslib_1.__exportStar(__nccwpck_require__(56635), exports);
tslib_1.__exportStar(__nccwpck_require__(17188), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 14400:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=pageBlob.js.map
/***/ }),
/***/ 26865:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=service.js.map
/***/ }),
/***/ 40535:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -72741,132 +72907,6 @@ const filterBlobsOperationSpec = {
/***/ }),
/***/ 56635:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=appendBlob.js.map
/***/ }),
/***/ 68355:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blob.js.map
/***/ }),
/***/ 17188:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blockBlob.js.map
/***/ }),
/***/ 15337:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=container.js.map
/***/ }),
/***/ 82354:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const tslib_1 = __nccwpck_require__(61860);
tslib_1.__exportStar(__nccwpck_require__(26865), exports);
tslib_1.__exportStar(__nccwpck_require__(15337), exports);
tslib_1.__exportStar(__nccwpck_require__(68355), exports);
tslib_1.__exportStar(__nccwpck_require__(14400), exports);
tslib_1.__exportStar(__nccwpck_require__(56635), exports);
tslib_1.__exportStar(__nccwpck_require__(17188), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 14400:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=pageBlob.js.map
/***/ }),
/***/ 26865:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=service.js.map
/***/ }),
/***/ 5313:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -72940,24 +72980,6 @@ exports.StorageClient = StorageClient;
/***/ }),
/***/ 83627:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnownEncryptionAlgorithmType = void 0;
/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */
var KnownEncryptionAlgorithmType;
(function (KnownEncryptionAlgorithmType) {
KnownEncryptionAlgorithmType["AES256"] = "AES256";
})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {}));
//# sourceMappingURL=generatedModels.js.map
/***/ }),
/***/ 71400:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {

@ -44019,6 +44019,7 @@ var Inputs;
Inputs["Path"] = "path";
Inputs["RestoreKeys"] = "restore-keys";
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["CompressionLevel"] = "compression-level";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
@ -44312,6 +44313,8 @@ exports.logWarning = logWarning;
exports.isValidEvent = isValidEvent;
exports.getInputAsArray = getInputAsArray;
exports.getInputAsInt = getInputAsInt;
exports.getCompressionLevel = getCompressionLevel;
exports.setCompressionLevel = setCompressionLevel;
exports.getInputAsBool = getInputAsBool;
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
const cache = __importStar(__nccwpck_require__(5116));
@ -44354,6 +44357,25 @@ function getInputAsInt(name, options) {
}
return value;
}
function getCompressionLevel(name, options) {
const rawValue = core.getInput(name, options);
if (rawValue === "") {
return undefined;
}
const compressionLevel = parseInt(rawValue, 10);
if (isNaN(compressionLevel) ||
compressionLevel < 0 ||
compressionLevel > 9) {
logWarning(`Invalid compression-level provided: ${rawValue}. Expected a value between 0 (no compression) and 9 (maximum compression).`);
return undefined;
}
return compressionLevel;
}
function setCompressionLevel(compressionLevel) {
const level = compressionLevel.toString();
process.env["ZSTD_CLEVEL"] = level;
process.env["GZIP"] = `-${level}`;
}
function getInputAsBool(name, options) {
const result = core.getInput(name, options);
return result.toLowerCase() === "true";
@ -59264,6 +59286,24 @@ exports.UserDelegationKeyCredential = UserDelegationKeyCredential;
/***/ }),
/***/ 83627:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnownEncryptionAlgorithmType = void 0;
/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */
var KnownEncryptionAlgorithmType;
(function (KnownEncryptionAlgorithmType) {
KnownEncryptionAlgorithmType["AES256"] = "AES256";
})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {}));
//# sourceMappingURL=generatedModels.js.map
/***/ }),
/***/ 30247:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -69536,6 +69576,132 @@ exports.listType = {
/***/ }),
/***/ 56635:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=appendBlob.js.map
/***/ }),
/***/ 68355:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blob.js.map
/***/ }),
/***/ 17188:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blockBlob.js.map
/***/ }),
/***/ 15337:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=container.js.map
/***/ }),
/***/ 82354:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const tslib_1 = __nccwpck_require__(61860);
tslib_1.__exportStar(__nccwpck_require__(26865), exports);
tslib_1.__exportStar(__nccwpck_require__(15337), exports);
tslib_1.__exportStar(__nccwpck_require__(68355), exports);
tslib_1.__exportStar(__nccwpck_require__(14400), exports);
tslib_1.__exportStar(__nccwpck_require__(56635), exports);
tslib_1.__exportStar(__nccwpck_require__(17188), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 14400:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=pageBlob.js.map
/***/ }),
/***/ 26865:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=service.js.map
/***/ }),
/***/ 40535:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -72741,132 +72907,6 @@ const filterBlobsOperationSpec = {
/***/ }),
/***/ 56635:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=appendBlob.js.map
/***/ }),
/***/ 68355:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blob.js.map
/***/ }),
/***/ 17188:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blockBlob.js.map
/***/ }),
/***/ 15337:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=container.js.map
/***/ }),
/***/ 82354:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const tslib_1 = __nccwpck_require__(61860);
tslib_1.__exportStar(__nccwpck_require__(26865), exports);
tslib_1.__exportStar(__nccwpck_require__(15337), exports);
tslib_1.__exportStar(__nccwpck_require__(68355), exports);
tslib_1.__exportStar(__nccwpck_require__(14400), exports);
tslib_1.__exportStar(__nccwpck_require__(56635), exports);
tslib_1.__exportStar(__nccwpck_require__(17188), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 14400:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=pageBlob.js.map
/***/ }),
/***/ 26865:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=service.js.map
/***/ }),
/***/ 5313:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -72940,24 +72980,6 @@ exports.StorageClient = StorageClient;
/***/ }),
/***/ 83627:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnownEncryptionAlgorithmType = void 0;
/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */
var KnownEncryptionAlgorithmType;
(function (KnownEncryptionAlgorithmType) {
KnownEncryptionAlgorithmType["AES256"] = "AES256";
})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {}));
//# sourceMappingURL=generatedModels.js.map
/***/ }),
/***/ 71400:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {

@ -44019,6 +44019,7 @@ var Inputs;
Inputs["Path"] = "path";
Inputs["RestoreKeys"] = "restore-keys";
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["CompressionLevel"] = "compression-level";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
@ -44135,6 +44136,10 @@ function saveImpl(stateProvider) {
required: true
});
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
const compressionLevel = utils.getCompressionLevel(constants_1.Inputs.CompressionLevel);
if (compressionLevel !== undefined) {
utils.setCompressionLevel(compressionLevel);
}
cacheId = yield cache.saveCache(cachePaths, primaryKey, { uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize) }, enableCrossOsArchive);
if (cacheId != -1) {
core.info(`Cache saved with key: ${primaryKey}`);
@ -44325,6 +44330,8 @@ exports.logWarning = logWarning;
exports.isValidEvent = isValidEvent;
exports.getInputAsArray = getInputAsArray;
exports.getInputAsInt = getInputAsInt;
exports.getCompressionLevel = getCompressionLevel;
exports.setCompressionLevel = setCompressionLevel;
exports.getInputAsBool = getInputAsBool;
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
const cache = __importStar(__nccwpck_require__(5116));
@ -44367,6 +44374,25 @@ function getInputAsInt(name, options) {
}
return value;
}
function getCompressionLevel(name, options) {
const rawValue = core.getInput(name, options);
if (rawValue === "") {
return undefined;
}
const compressionLevel = parseInt(rawValue, 10);
if (isNaN(compressionLevel) ||
compressionLevel < 0 ||
compressionLevel > 9) {
logWarning(`Invalid compression-level provided: ${rawValue}. Expected a value between 0 (no compression) and 9 (maximum compression).`);
return undefined;
}
return compressionLevel;
}
function setCompressionLevel(compressionLevel) {
const level = compressionLevel.toString();
process.env["ZSTD_CLEVEL"] = level;
process.env["GZIP"] = `-${level}`;
}
function getInputAsBool(name, options) {
const result = core.getInput(name, options);
return result.toLowerCase() === "true";
@ -59277,6 +59303,24 @@ exports.UserDelegationKeyCredential = UserDelegationKeyCredential;
/***/ }),
/***/ 83627:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnownEncryptionAlgorithmType = void 0;
/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */
var KnownEncryptionAlgorithmType;
(function (KnownEncryptionAlgorithmType) {
KnownEncryptionAlgorithmType["AES256"] = "AES256";
})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {}));
//# sourceMappingURL=generatedModels.js.map
/***/ }),
/***/ 30247:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -69549,6 +69593,132 @@ exports.listType = {
/***/ }),
/***/ 56635:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=appendBlob.js.map
/***/ }),
/***/ 68355:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blob.js.map
/***/ }),
/***/ 17188:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blockBlob.js.map
/***/ }),
/***/ 15337:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=container.js.map
/***/ }),
/***/ 82354:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const tslib_1 = __nccwpck_require__(61860);
tslib_1.__exportStar(__nccwpck_require__(26865), exports);
tslib_1.__exportStar(__nccwpck_require__(15337), exports);
tslib_1.__exportStar(__nccwpck_require__(68355), exports);
tslib_1.__exportStar(__nccwpck_require__(14400), exports);
tslib_1.__exportStar(__nccwpck_require__(56635), exports);
tslib_1.__exportStar(__nccwpck_require__(17188), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 14400:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=pageBlob.js.map
/***/ }),
/***/ 26865:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=service.js.map
/***/ }),
/***/ 40535:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -72754,132 +72924,6 @@ const filterBlobsOperationSpec = {
/***/ }),
/***/ 56635:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=appendBlob.js.map
/***/ }),
/***/ 68355:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blob.js.map
/***/ }),
/***/ 17188:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blockBlob.js.map
/***/ }),
/***/ 15337:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=container.js.map
/***/ }),
/***/ 82354:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const tslib_1 = __nccwpck_require__(61860);
tslib_1.__exportStar(__nccwpck_require__(26865), exports);
tslib_1.__exportStar(__nccwpck_require__(15337), exports);
tslib_1.__exportStar(__nccwpck_require__(68355), exports);
tslib_1.__exportStar(__nccwpck_require__(14400), exports);
tslib_1.__exportStar(__nccwpck_require__(56635), exports);
tslib_1.__exportStar(__nccwpck_require__(17188), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 14400:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=pageBlob.js.map
/***/ }),
/***/ 26865:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=service.js.map
/***/ }),
/***/ 5313:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -72953,24 +72997,6 @@ exports.StorageClient = StorageClient;
/***/ }),
/***/ 83627:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnownEncryptionAlgorithmType = void 0;
/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */
var KnownEncryptionAlgorithmType;
(function (KnownEncryptionAlgorithmType) {
KnownEncryptionAlgorithmType["AES256"] = "AES256";
})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {}));
//# sourceMappingURL=generatedModels.js.map
/***/ }),
/***/ 71400:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {

314
dist/save/index.js vendored

@ -44019,6 +44019,7 @@ var Inputs;
Inputs["Path"] = "path";
Inputs["RestoreKeys"] = "restore-keys";
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["CompressionLevel"] = "compression-level";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
@ -44135,6 +44136,10 @@ function saveImpl(stateProvider) {
required: true
});
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
const compressionLevel = utils.getCompressionLevel(constants_1.Inputs.CompressionLevel);
if (compressionLevel !== undefined) {
utils.setCompressionLevel(compressionLevel);
}
cacheId = yield cache.saveCache(cachePaths, primaryKey, { uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize) }, enableCrossOsArchive);
if (cacheId != -1) {
core.info(`Cache saved with key: ${primaryKey}`);
@ -44325,6 +44330,8 @@ exports.logWarning = logWarning;
exports.isValidEvent = isValidEvent;
exports.getInputAsArray = getInputAsArray;
exports.getInputAsInt = getInputAsInt;
exports.getCompressionLevel = getCompressionLevel;
exports.setCompressionLevel = setCompressionLevel;
exports.getInputAsBool = getInputAsBool;
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
const cache = __importStar(__nccwpck_require__(5116));
@ -44367,6 +44374,25 @@ function getInputAsInt(name, options) {
}
return value;
}
function getCompressionLevel(name, options) {
const rawValue = core.getInput(name, options);
if (rawValue === "") {
return undefined;
}
const compressionLevel = parseInt(rawValue, 10);
if (isNaN(compressionLevel) ||
compressionLevel < 0 ||
compressionLevel > 9) {
logWarning(`Invalid compression-level provided: ${rawValue}. Expected a value between 0 (no compression) and 9 (maximum compression).`);
return undefined;
}
return compressionLevel;
}
function setCompressionLevel(compressionLevel) {
const level = compressionLevel.toString();
process.env["ZSTD_CLEVEL"] = level;
process.env["GZIP"] = `-${level}`;
}
function getInputAsBool(name, options) {
const result = core.getInput(name, options);
return result.toLowerCase() === "true";
@ -59277,6 +59303,24 @@ exports.UserDelegationKeyCredential = UserDelegationKeyCredential;
/***/ }),
/***/ 83627:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnownEncryptionAlgorithmType = void 0;
/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */
var KnownEncryptionAlgorithmType;
(function (KnownEncryptionAlgorithmType) {
KnownEncryptionAlgorithmType["AES256"] = "AES256";
})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {}));
//# sourceMappingURL=generatedModels.js.map
/***/ }),
/***/ 30247:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -69549,6 +69593,132 @@ exports.listType = {
/***/ }),
/***/ 56635:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=appendBlob.js.map
/***/ }),
/***/ 68355:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blob.js.map
/***/ }),
/***/ 17188:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blockBlob.js.map
/***/ }),
/***/ 15337:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=container.js.map
/***/ }),
/***/ 82354:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const tslib_1 = __nccwpck_require__(61860);
tslib_1.__exportStar(__nccwpck_require__(26865), exports);
tslib_1.__exportStar(__nccwpck_require__(15337), exports);
tslib_1.__exportStar(__nccwpck_require__(68355), exports);
tslib_1.__exportStar(__nccwpck_require__(14400), exports);
tslib_1.__exportStar(__nccwpck_require__(56635), exports);
tslib_1.__exportStar(__nccwpck_require__(17188), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 14400:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=pageBlob.js.map
/***/ }),
/***/ 26865:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=service.js.map
/***/ }),
/***/ 40535:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -72754,132 +72924,6 @@ const filterBlobsOperationSpec = {
/***/ }),
/***/ 56635:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=appendBlob.js.map
/***/ }),
/***/ 68355:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blob.js.map
/***/ }),
/***/ 17188:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=blockBlob.js.map
/***/ }),
/***/ 15337:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=container.js.map
/***/ }),
/***/ 82354:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const tslib_1 = __nccwpck_require__(61860);
tslib_1.__exportStar(__nccwpck_require__(26865), exports);
tslib_1.__exportStar(__nccwpck_require__(15337), exports);
tslib_1.__exportStar(__nccwpck_require__(68355), exports);
tslib_1.__exportStar(__nccwpck_require__(14400), exports);
tslib_1.__exportStar(__nccwpck_require__(56635), exports);
tslib_1.__exportStar(__nccwpck_require__(17188), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 14400:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=pageBlob.js.map
/***/ }),
/***/ 26865:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
//# sourceMappingURL=service.js.map
/***/ }),
/***/ 5313:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@ -72953,24 +72997,6 @@ exports.StorageClient = StorageClient;
/***/ }),
/***/ 83627:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnownEncryptionAlgorithmType = void 0;
/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */
var KnownEncryptionAlgorithmType;
(function (KnownEncryptionAlgorithmType) {
KnownEncryptionAlgorithmType["AES256"] = "AES256";
})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {}));
//# sourceMappingURL=generatedModels.js.map
/***/ }),
/***/ 71400:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {

@ -9,6 +9,7 @@ The save action saves a cache. It works similarly to the `cache` action except t
* `key` - An explicit key for a cache entry. See [creating a cache key](../README.md#creating-a-cache-key).
* `path` - A list of files, directories, and wildcard patterns to cache. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns.
* `upload-chunk-size` - The chunk size used to split up large files during upload, in bytes
* `compression-level` - Compression level to use when creating cache archives (save-only action). Use `0` for no compression and `9` for maximum compression. Defaults to the compression tool's standard level when unset.
### Outputs
@ -16,7 +17,6 @@ This action has no outputs.
## Use cases
### Only save cache
If you are using separate jobs for generating common artifacts and sharing them across jobs, this action will take care of your cache saving needs.
@ -54,6 +54,7 @@ with:
```
#### Case 1 - Where a user would want to reuse the key as it is
```yaml
uses: actions/cache/save@v4
with:

@ -11,6 +11,9 @@ inputs:
upload-chunk-size:
description: 'The chunk size used to split up large files during upload, in bytes'
required: false
compression-level:
description: 'Compression level used when creating cache archives (save-only action). Set 0 for no compression and 9 for maximum compression. Defaults to the compression tool defaults when unset'
required: false
enableCrossOsArchive:
description: 'An optional boolean when enabled, allows windows runners to save caches that can be restored on other platforms'
default: 'false'

@ -3,6 +3,7 @@ export enum Inputs {
Path = "path", // Input for cache, restore, save action
RestoreKeys = "restore-keys", // Input for cache, restore action
UploadChunkSize = "upload-chunk-size", // Input for cache, save action
CompressionLevel = "compression-level", // Input for cache, save action
EnableCrossOsArchive = "enableCrossOsArchive", // Input for cache, restore, save action
FailOnCacheMiss = "fail-on-cache-miss", // Input for cache, restore action
LookupOnly = "lookup-only" // Input for cache, restore action

@ -25,8 +25,7 @@ export async function saveImpl(
if (!utils.isValidEvent()) {
utils.logWarning(
`Event Validation Error: The event type ${
process.env[Events.Key]
`Event Validation Error: The event type ${process.env[Events.Key]
} is not supported because it's not tied to a branch or tag ref.`
);
return;
@ -62,6 +61,14 @@ export async function saveImpl(
Inputs.EnableCrossOsArchive
);
const compressionLevel = utils.getCompressionLevel(
Inputs.CompressionLevel
);
if (compressionLevel !== undefined) {
utils.setCompressionLevel(compressionLevel);
}
cacheId = await cache.saveCache(
cachePaths,
primaryKey,

@ -58,6 +58,38 @@ export function getInputAsInt(
return value;
}
export function getCompressionLevel(
name: string,
options?: core.InputOptions
): number | undefined {
const rawValue = core.getInput(name, options);
if (rawValue === "") {
return undefined;
}
const compressionLevel = parseInt(rawValue, 10);
if (
isNaN(compressionLevel) ||
compressionLevel < 0 ||
compressionLevel > 9
) {
logWarning(
`Invalid compression-level provided: ${rawValue}. Expected a value between 0 (no compression) and 9 (maximum compression).`
);
return undefined;
}
return compressionLevel;
}
export function setCompressionLevel(compressionLevel: number): void {
const level = compressionLevel.toString();
process.env["ZSTD_CLEVEL"] = level;
process.env["GZIP"] = `-${level}`;
}
export function getInputAsBool(
name: string,
options?: core.InputOptions

Loading…
Cancel
Save