From c6723084aaf141e046e0e027f0bcba989bfaac73 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Wed, 6 Aug 2025 11:37:53 -0700 Subject: [PATCH 1/7] Prepare release 4.0.4 --- packages/cache/RELEASES.md | 7 +++++++ packages/cache/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/cache/RELEASES.md b/packages/cache/RELEASES.md index c8ce346f..26acae94 100644 --- a/packages/cache/RELEASES.md +++ b/packages/cache/RELEASES.md @@ -1,5 +1,12 @@ # @actions/cache Releases +### 4.0.4 + +- Optimized cache dependencies by moving `@protobuf-ts/plugin` to dev dependencies [#2106](https://github.com/actions/toolkit/pull/2106) +- Improved cache service availability determination for different cache service versions (v1 and v2) [#2100](https://github.com/actions/toolkit/pull/2100) +- Enhanced server error handling: 5xx HTTP errors are now logged as errors instead of warnings [#2099](https://github.com/actions/toolkit/pull/2099) +- Fixed cache hit logging to properly distinguish between exact key matches and restore key matches [#2101](https://github.com/actions/toolkit/pull/2101) + ### 4.0.3 - Added masking for Shared Access Signature (SAS) cache entry URLs [#1982](https://github.com/actions/toolkit/pull/1982) diff --git a/packages/cache/package.json b/packages/cache/package.json index 4d630ed2..1680f8f3 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "4.0.3", + "version": "4.0.4", "preview": true, "description": "Actions cache lib", "keywords": [ From 6c64260c6d6d8c433ad519569272e49f0c94ef01 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 7 Aug 2025 03:15:33 -0700 Subject: [PATCH 2/7] Reintroduce @protobuf-ts/runtime as a runtime dependency v2.11.1 --- packages/cache/package-lock.json | 19 +++++++++---------- packages/cache/package.json | 1 + 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/cache/package-lock.json b/packages/cache/package-lock.json index 0f73cb7b..f1828f56 100644 --- a/packages/cache/package-lock.json +++ b/packages/cache/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/cache", - "version": "4.0.3", + "version": "4.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/cache", - "version": "4.0.3", + "version": "4.0.4", "license": "MIT", "dependencies": { "@actions/core": "^1.11.1", @@ -17,6 +17,7 @@ "@azure/abort-controller": "^1.1.0", "@azure/ms-rest-js": "^2.6.0", "@azure/storage-blob": "^12.13.0", + "@protobuf-ts/runtime": "^2.11.1", "semver": "^6.3.1" }, "devDependencies": { @@ -318,10 +319,9 @@ } }, "node_modules/@protobuf-ts/runtime": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz", - "integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg==", - "dev": true, + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.11.1.tgz", + "integrity": "sha512-KuDaT1IfHkugM2pyz+FwiY80ejWrkH1pAtOBOZFuR6SXEFTsnb/jiQWQ1rCIrcKx2BtyxnxW6BWwsVSA/Ie+WQ==", "license": "(Apache-2.0 AND BSD-3-Clause)" }, "node_modules/@protobuf-ts/runtime-rpc": { @@ -1045,10 +1045,9 @@ "dev": true }, "@protobuf-ts/runtime": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz", - "integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg==", - "dev": true + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.11.1.tgz", + "integrity": "sha512-KuDaT1IfHkugM2pyz+FwiY80ejWrkH1pAtOBOZFuR6SXEFTsnb/jiQWQ1rCIrcKx2BtyxnxW6BWwsVSA/Ie+WQ==" }, "@protobuf-ts/runtime-rpc": { "version": "2.9.4", diff --git a/packages/cache/package.json b/packages/cache/package.json index 1680f8f3..7d0e8da2 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -40,6 +40,7 @@ "@actions/core": "^1.11.1", "@actions/exec": "^1.0.1", "@actions/glob": "^0.1.0", + "@protobuf-ts/runtime": "^2.11.1", "@actions/http-client": "^2.1.1", "@actions/io": "^1.0.1", "@azure/abort-controller": "^1.1.0", From 01715621b0a7dd28d242f39b637e00c42f4899a0 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 7 Aug 2025 03:21:24 -0700 Subject: [PATCH 3/7] Replace @protobuf-ts/runtime with higher level dep @protobuf-ts/runtime-rpc --- packages/cache/package-lock.json | 20 +++++++++----------- packages/cache/package.json | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/cache/package-lock.json b/packages/cache/package-lock.json index f1828f56..ff453d08 100644 --- a/packages/cache/package-lock.json +++ b/packages/cache/package-lock.json @@ -17,7 +17,7 @@ "@azure/abort-controller": "^1.1.0", "@azure/ms-rest-js": "^2.6.0", "@azure/storage-blob": "^12.13.0", - "@protobuf-ts/runtime": "^2.11.1", + "@protobuf-ts/runtime-rpc": "^2.11.1", "semver": "^6.3.1" }, "devDependencies": { @@ -325,13 +325,12 @@ "license": "(Apache-2.0 AND BSD-3-Clause)" }, "node_modules/@protobuf-ts/runtime-rpc": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz", - "integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==", - "dev": true, + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.11.1.tgz", + "integrity": "sha512-4CqqUmNA+/uMz00+d3CYKgElXO9VrEbucjnBFEjqI4GuDrEQ32MaI3q+9qPBvIGOlL4PmHXrzM32vBPWRhQKWQ==", "license": "Apache-2.0", "dependencies": { - "@protobuf-ts/runtime": "^2.9.4" + "@protobuf-ts/runtime": "^2.11.1" } }, "node_modules/@types/node": { @@ -1050,12 +1049,11 @@ "integrity": "sha512-KuDaT1IfHkugM2pyz+FwiY80ejWrkH1pAtOBOZFuR6SXEFTsnb/jiQWQ1rCIrcKx2BtyxnxW6BWwsVSA/Ie+WQ==" }, "@protobuf-ts/runtime-rpc": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz", - "integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==", - "dev": true, + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.11.1.tgz", + "integrity": "sha512-4CqqUmNA+/uMz00+d3CYKgElXO9VrEbucjnBFEjqI4GuDrEQ32MaI3q+9qPBvIGOlL4PmHXrzM32vBPWRhQKWQ==", "requires": { - "@protobuf-ts/runtime": "^2.9.4" + "@protobuf-ts/runtime": "^2.11.1" } }, "@types/node": { diff --git a/packages/cache/package.json b/packages/cache/package.json index 7d0e8da2..32529dc0 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -40,7 +40,7 @@ "@actions/core": "^1.11.1", "@actions/exec": "^1.0.1", "@actions/glob": "^0.1.0", - "@protobuf-ts/runtime": "^2.11.1", + "@protobuf-ts/runtime-rpc": "^2.11.1", "@actions/http-client": "^2.1.1", "@actions/io": "^1.0.1", "@azure/abort-controller": "^1.1.0", From c9316bb4a78d8b57eccc4b8db46ce57bbef8d2fb Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 7 Aug 2025 03:38:19 -0700 Subject: [PATCH 4/7] Update cache package compilation step to install only runtime dependencies --- .github/workflows/cache-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cache-tests.yml b/.github/workflows/cache-tests.yml index dfe89f68..79654460 100644 --- a/.github/workflows/cache-tests.yml +++ b/.github/workflows/cache-tests.yml @@ -39,9 +39,11 @@ jobs: - name: Install root npm packages run: npm ci + # We need to install only runtime dependencies (omit dev dependencies) to verify that what we're shipping is all + # that is needed - name: Compile cache package run: | - npm ci + npm install --omit=dev npm run tsc working-directory: packages/cache From 3a607d0f0048ec4ac856333213fc2fe3b1114799 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 7 Aug 2025 12:40:20 +0200 Subject: [PATCH 5/7] Update .github/workflows/cache-tests.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/cache-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache-tests.yml b/.github/workflows/cache-tests.yml index 79654460..9dee0657 100644 --- a/.github/workflows/cache-tests.yml +++ b/.github/workflows/cache-tests.yml @@ -43,7 +43,7 @@ jobs: # that is needed - name: Compile cache package run: | - npm install --omit=dev + npm ci --omit=dev npm run tsc working-directory: packages/cache From f3e6fb165e50a3876a36f28a9b8e620cdeb39f75 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 7 Aug 2025 03:49:51 -0700 Subject: [PATCH 6/7] Fix linter complaints --- packages/cache/__tests__/saveCache.test.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/cache/__tests__/saveCache.test.ts b/packages/cache/__tests__/saveCache.test.ts index ab5d3803..5a4f8f9a 100644 --- a/packages/cache/__tests__/saveCache.test.ts +++ b/packages/cache/__tests__/saveCache.test.ts @@ -225,23 +225,22 @@ test('save with server error should fail', async () => { const filePath = 'node_modules' const primaryKey = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43' const logErrorMock = jest.spyOn(core, 'error') - const logWarningMock = jest.spyOn(core, 'warning') // Mock cache service version to V2 - const getCacheServiceVersionMock = jest.spyOn(config, 'getCacheServiceVersion').mockReturnValue('v2') + const getCacheServiceVersionMock = jest + .spyOn(config, 'getCacheServiceVersion') + .mockReturnValue('v2') // Mock V2 CreateCacheEntry to succeed const createCacheEntryMock = jest .spyOn(CacheServiceClientJSON.prototype, 'CreateCacheEntry') .mockReturnValue( - Promise.resolve({ok: true, signedUploadUrl: 'https://blob-storage.local?signed=true'}) + Promise.resolve({ + ok: true, + signedUploadUrl: 'https://blob-storage.local?signed=true' + }) ) - // Mock the FinalizeCacheEntryUpload to succeed (since the error should happen in saveCache) - const finalizeCacheEntryMock = jest - .spyOn(CacheServiceClientJSON.prototype, 'FinalizeCacheEntryUpload') - .mockReturnValue(Promise.resolve({ok: true, entryId: '4'})) - const createTarMock = jest.spyOn(tar, 'createTar') // Mock the saveCache call to throw a server error @@ -257,7 +256,7 @@ test('save with server error should fail', async () => { .mockReturnValueOnce(Promise.resolve(compression)) await saveCache([filePath], primaryKey) - + expect(logErrorMock).toHaveBeenCalledTimes(1) expect(logErrorMock).toHaveBeenCalledWith( 'Failed to save: HTTP Error Occurred' @@ -266,7 +265,6 @@ test('save with server error should fail', async () => { expect(createCacheEntryMock).toHaveBeenCalledTimes(1) const archiveFolder = '/foo/bar' const cachePaths = [path.resolve(filePath)] - const archiveFile = path.join(archiveFolder, CacheFilename.Zstd) expect(createTarMock).toHaveBeenCalledTimes(1) expect(createTarMock).toHaveBeenCalledWith( archiveFolder, @@ -276,7 +274,7 @@ test('save with server error should fail', async () => { expect(saveCacheMock).toHaveBeenCalledTimes(1) expect(getCompressionMock).toHaveBeenCalledTimes(1) expect(getCompressionMock).toHaveBeenCalledTimes(1) - + // Restore the getCacheServiceVersion mock to its original state getCacheServiceVersionMock.mockRestore() }) From 447ee85f36982f10b75e5768650bc89f7903abff Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 7 Aug 2025 04:00:47 -0700 Subject: [PATCH 7/7] Prepare release 4.0.5 --- packages/cache/RELEASES.md | 6 ++++++ packages/cache/package-lock.json | 4 ++-- packages/cache/package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/cache/RELEASES.md b/packages/cache/RELEASES.md index 26acae94..74bb7fa5 100644 --- a/packages/cache/RELEASES.md +++ b/packages/cache/RELEASES.md @@ -1,7 +1,13 @@ # @actions/cache Releases +### 4.0.5 + +- Reintroduce @protobuf-ts/runtime-rpc as a runtime dependency [#2113](https://github.com/actions/toolkit/pull/2113) + ### 4.0.4 +⚠️ Faulty patch release. Upgrade to 4.0.5 instead. + - Optimized cache dependencies by moving `@protobuf-ts/plugin` to dev dependencies [#2106](https://github.com/actions/toolkit/pull/2106) - Improved cache service availability determination for different cache service versions (v1 and v2) [#2100](https://github.com/actions/toolkit/pull/2100) - Enhanced server error handling: 5xx HTTP errors are now logged as errors instead of warnings [#2099](https://github.com/actions/toolkit/pull/2099) diff --git a/packages/cache/package-lock.json b/packages/cache/package-lock.json index ff453d08..692aea76 100644 --- a/packages/cache/package-lock.json +++ b/packages/cache/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/cache", - "version": "4.0.4", + "version": "4.0.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/cache", - "version": "4.0.4", + "version": "4.0.5", "license": "MIT", "dependencies": { "@actions/core": "^1.11.1", diff --git a/packages/cache/package.json b/packages/cache/package.json index 32529dc0..40dc8b64 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "4.0.4", + "version": "4.0.5", "preview": true, "description": "Actions cache lib", "keywords": [