Bump @actions/cache to v6.1.0 - handle cache write error due to RO token

This commit is contained in:
Jason Ginchereau
2026-06-18 12:26:16 -07:00
parent 2c8a9bd745
commit d8cd72f230
23 changed files with 26962 additions and 3315 deletions

View File

@@ -95,7 +95,11 @@ test("save with valid inputs uploads a cache", async () => {
expect(core.setFailed).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 failedMock = jest.spyOn(core, "setFailed");
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
const inputPath = "node_modules";
@@ -103,6 +107,9 @@ test("save failing logs the warning message", async () => {
testUtils.setInput(Inputs.Path, inputPath);
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;
(cache.saveCache as jest.Mock).mockResolvedValue(cacheId);
@@ -118,6 +125,7 @@ test("save failing logs the warning message", async () => {
false
);
expect(core.warning).toHaveBeenCalledTimes(1);
expect(core.warning).toHaveBeenCalledWith("Cache save failed.");
expect(debugMock).toHaveBeenCalledWith("Cache was not saved.");
expect(warningMock).not.toHaveBeenCalled();
expect(failedMock).not.toHaveBeenCalled();
});