@actions/cache: convert to an ESM module (#2275)

* `@actions/cache`: convert to an ESM module

* Update the fixture to ESM syntax

* Update the cache workflows

* Bump `@actions/glob` to `0.6.1`

* Fix awaiting in the cache unit tests

* Fix a type issues in contracts

* Export the `DownloadOptions`/`UploadOptions` like before

* More cache test fixes

* Make the cache units tests better

* Add some more logging

* Add retries to restore-cache.mjs
This commit is contained in:
Daniel Kennedy
2026-01-29 14:23:32 -05:00
committed by GitHub
parent b48854e1ac
commit ae29a2751b
25 changed files with 275 additions and 288 deletions
+3 -7
View File
@@ -55,10 +55,8 @@ jobs:
shell: bash shell: bash
run: packages/cache/__tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache run: packages/cache/__tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
# We're using node -e to call the functions directly available in the @actions/cache package
- name: Save cache using saveCache() - name: Save cache using saveCache()
run: | run: node packages/cache/__tests__/save-cache.mjs ${{ runner.os }} ${{ github.run_id }}
node -e "Promise.resolve(require('./packages/cache/lib/cache').saveCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}'))"
- name: Delete cache folders before restoring - name: Delete cache folders before restoring
shell: bash shell: bash
@@ -67,8 +65,7 @@ jobs:
rm -rf ~/test-cache rm -rf ~/test-cache
- name: Restore cache using restoreCache() with http-client - name: Restore cache using restoreCache() with http-client
run: | run: node packages/cache/__tests__/restore-cache.mjs ${{ runner.os }} ${{ github.run_id }} false
node -e "Promise.resolve(require('./packages/cache/lib/cache').restoreCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}',[],{useAzureSdk: false}))"
- name: Verify cache restored with http-client - name: Verify cache restored with http-client
shell: bash shell: bash
@@ -83,8 +80,7 @@ jobs:
rm -rf ~/test-cache rm -rf ~/test-cache
- name: Restore cache using restoreCache() with Azure SDK - name: Restore cache using restoreCache() with Azure SDK
run: | run: node packages/cache/__tests__/restore-cache.mjs ${{ runner.os }} ${{ github.run_id }} true
node -e "Promise.resolve(require('./packages/cache/lib/cache').restoreCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}'))"
- name: Verify cache restored with Azure SDK - name: Verify cache restored with Azure SDK
shell: bash shell: bash
+3 -7
View File
@@ -52,10 +52,8 @@ jobs:
shell: bash shell: bash
run: packages/cache/__tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache run: packages/cache/__tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
# We're using node -e to call the functions directly available in the @actions/cache package
- name: Save cache using saveCache() - name: Save cache using saveCache()
run: | run: node packages/cache/__tests__/save-cache.mjs ${{ runner.os }} ${{ github.run_id }}
node -e "Promise.resolve(require('./packages/cache/lib/cache').saveCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}'))"
- name: Delete cache folders before restoring - name: Delete cache folders before restoring
shell: bash shell: bash
@@ -64,8 +62,7 @@ jobs:
rm -rf ~/test-cache rm -rf ~/test-cache
- name: Restore cache using restoreCache() with http-client - name: Restore cache using restoreCache() with http-client
run: | run: node packages/cache/__tests__/restore-cache.mjs ${{ runner.os }} ${{ github.run_id }} false
node -e "Promise.resolve(require('./packages/cache/lib/cache').restoreCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}',[],{useAzureSdk: false}))"
- name: Verify cache restored with http-client - name: Verify cache restored with http-client
shell: bash shell: bash
@@ -80,8 +77,7 @@ jobs:
rm -rf ~/test-cache rm -rf ~/test-cache
- name: Restore cache using restoreCache() with Azure SDK - name: Restore cache using restoreCache() with Azure SDK
run: | run: node packages/cache/__tests__/restore-cache.mjs ${{ runner.os }} ${{ github.run_id }} true
node -e "Promise.resolve(require('./packages/cache/lib/cache').restoreCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}'))"
- name: Verify cache restored with Azure SDK - name: Verify cache restored with Azure SDK
shell: bash shell: bash
+3 -2
View File
@@ -16,7 +16,8 @@ module.exports = {
'^@actions/github$': '<rootDir>/packages/github/lib/github.js', '^@actions/github$': '<rootDir>/packages/github/lib/github.js',
'^@actions/github/lib/utils$': '<rootDir>/packages/github/lib/utils.js', '^@actions/github/lib/utils$': '<rootDir>/packages/github/lib/utils.js',
'^@actions/glob$': '<rootDir>/packages/glob/lib/glob.js', '^@actions/glob$': '<rootDir>/packages/glob/lib/glob.js',
'^@actions/tool-cache$': '<rootDir>/packages/tool-cache/lib/tool-cache.js' '^@actions/tool-cache$': '<rootDir>/packages/tool-cache/lib/tool-cache.js',
'^@actions/cache$': '<rootDir>/packages/cache/lib/cache.js'
}, },
transform: { transform: {
'^.+\\.(ts|js)$': ['ts-jest', { '^.+\\.(ts|js)$': ['ts-jest', {
@@ -30,7 +31,7 @@ module.exports = {
}] }]
}, },
transformIgnorePatterns: [ transformIgnorePatterns: [
'/node_modules/(?!(@octokit|@actions/github|@actions/http-client|@actions/io|@actions/exec|@actions/core|@actions/glob|@actions/tool-cache|universal-user-agent|before-after-hook)/)' '/node_modules/(?!(@octokit|@actions/github|@actions/http-client|@actions/io|@actions/exec|@actions/core|@actions/glob|@actions/tool-cache|@actions/cache|universal-user-agent|before-after-hook)/)'
], ],
verbose: true verbose: true
} }
+59 -54
View File
@@ -1,23 +1,28 @@
# @actions/cache Releases # @actions/cache Releases
### 5.0.5 ## 6.0.0
- **Breaking change**: Package is now ESM-only
- CommonJS consumers must use dynamic `import()` instead of `require()`
## 5.0.5
- Bump `@actions/glob` to `0.5.1` - Bump `@actions/glob` to `0.5.1`
### 5.0.4 ## 5.0.4
- Bump `@actions/http-client` to `3.0.2` - Bump `@actions/http-client` to `3.0.2`
### 5.0.3 ## 5.0.3
Prevent retries for rate limited cache operations [2243](https://github.com/actions/toolkit/pull/2243). Prevent retries for rate limited cache operations [2243](https://github.com/actions/toolkit/pull/2243).
### 5.0.1 ## 5.0.1
- Fix Node.js 24 punycode deprecation warning by updating `@azure/storage-blob` from `^12.13.0` to `^12.29.1` [#2213](https://github.com/actions/toolkit/pull/2213) - Fix Node.js 24 punycode deprecation warning by updating `@azure/storage-blob` from `^12.13.0` to `^12.29.1` [#2213](https://github.com/actions/toolkit/pull/2213)
- Newer storage-blob uses `@azure/core-rest-pipeline` instead of deprecated `@azure/core-http`, which eliminates the transitive dependency on `node-fetch@2``whatwg-url@5``[email protected]` that used the deprecated punycode module - Newer storage-blob uses `@azure/core-rest-pipeline` instead of deprecated `@azure/core-http`, which eliminates the transitive dependency on `node-fetch@2``whatwg-url@5``[email protected]` that used the deprecated punycode module
### 5.0.0 ## 5.0.0
- Remove `@azure/ms-rest-js` dependency [#2197](https://github.com/actions/toolkit/pull/2197) - Remove `@azure/ms-rest-js` dependency [#2197](https://github.com/actions/toolkit/pull/2197)
- The `TransferProgressEvent` type is now imported from `@azure/core-rest-pipeline` instead of `@azure/ms-rest-js` - The `TransferProgressEvent` type is now imported from `@azure/core-rest-pipeline` instead of `@azure/ms-rest-js`
@@ -29,15 +34,15 @@ Prevent retries for rate limited cache operations [2243](https://github.com/acti
- Add support for Node.js 24 [#2110](https://github.com/actions/toolkit/pull/2110) - Add support for Node.js 24 [#2110](https://github.com/actions/toolkit/pull/2110)
- Add `node-fetch` override to resolve audit vulnerabilities [#2110](https://github.com/actions/toolkit/pull/2110) - Add `node-fetch` override to resolve audit vulnerabilities [#2110](https://github.com/actions/toolkit/pull/2110)
### 4.1.0 ## 4.1.0
- Remove client side 10GiB cache size limit check & update twirp client [#2118](https://github.com/actions/toolkit/pull/2118) - Remove client side 10GiB cache size limit check & update twirp client [#2118](https://github.com/actions/toolkit/pull/2118)
### 4.0.5 ## 4.0.5
- Reintroduce @protobuf-ts/runtime-rpc as a runtime dependency [#2113](https://github.com/actions/toolkit/pull/2113) - Reintroduce @protobuf-ts/runtime-rpc as a runtime dependency [#2113](https://github.com/actions/toolkit/pull/2113)
### 4.0.4 ## 4.0.4
⚠️ Faulty patch release. Upgrade to 4.0.5 instead. ⚠️ Faulty patch release. Upgrade to 4.0.5 instead.
@@ -46,23 +51,23 @@ Prevent retries for rate limited cache operations [2243](https://github.com/acti
- Enhanced server error handling: 5xx HTTP errors are now logged as errors instead of warnings [#2099](https://github.com/actions/toolkit/pull/2099) - 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) - 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 ## 4.0.3
- Added masking for Shared Access Signature (SAS) cache entry URLs [#1982](https://github.com/actions/toolkit/pull/1982) - Added masking for Shared Access Signature (SAS) cache entry URLs [#1982](https://github.com/actions/toolkit/pull/1982)
- Improved debugging by logging both the cache version alongside the keys requested when a cache restore fails [#1994](https://github.com/actions/toolkit/pull/1994) - Improved debugging by logging both the cache version alongside the keys requested when a cache restore fails [#1994](https://github.com/actions/toolkit/pull/1994)
### 4.0.2 ## 4.0.2
- Wrap create failures in ReserveCacheError [#1966](https://github.com/actions/toolkit/pull/1966) - Wrap create failures in ReserveCacheError [#1966](https://github.com/actions/toolkit/pull/1966)
### 4.0.1 ## 4.0.1
- Remove runtime dependency on `twirp-ts` [#1947](https://github.com/actions/toolkit/pull/1947) - Remove runtime dependency on `twirp-ts` [#1947](https://github.com/actions/toolkit/pull/1947)
- Cache miss as debug, not warning annotation [#1954](https://github.com/actions/toolkit/pull/1954) - Cache miss as debug, not warning annotation [#1954](https://github.com/actions/toolkit/pull/1954)
### 4.0.0 ## 4.0.0
#### Important changes ### Important changes
The cache backend service has been rewritten from the ground up for improved performance and reliability. The [@actions/cache](https://github.com/actions/toolkit/tree/main/packages/cache) package now integrates with the new cache service (v2) APIs. The cache backend service has been rewritten from the ground up for improved performance and reliability. The [@actions/cache](https://github.com/actions/toolkit/tree/main/packages/cache) package now integrates with the new cache service (v2) APIs.
@@ -76,182 +81,182 @@ Upgrading to the recommended version should not break or require any changes to
Read more about the change & access the migration guide: [reference to the announcement](https://github.com/actions/toolkit/discussions/1890). Read more about the change & access the migration guide: [reference to the announcement](https://github.com/actions/toolkit/discussions/1890).
#### Minor changes ### Minor changes
- Update `@actions/core` to `1.11.0` - Update `@actions/core` to `1.11.0`
- Update `semver` `6.3.1` - Update `semver` `6.3.1`
- Add `twirp-ts` `2.5.0` to dependencies - Add `twirp-ts` `2.5.0` to dependencies
### 3.3.0 ## 3.3.0
- Update `@actions/core` to `1.11.1` - Update `@actions/core` to `1.11.1`
- Remove dependency on `uuid` package [#1824](https://github.com/actions/toolkit/pull/1824), [#1842](https://github.com/actions/toolkit/pull/1842) - Remove dependency on `uuid` package [#1824](https://github.com/actions/toolkit/pull/1824), [#1842](https://github.com/actions/toolkit/pull/1842)
### 3.2.4 ## 3.2.4
- Updated `isGhes` check to include `.ghe.com` and `.ghe.localhost` as accepted hosts - Updated `isGhes` check to include `.ghe.com` and `.ghe.localhost` as accepted hosts
### 3.2.3 ## 3.2.3
- Fixed a bug that mutated path arguments to `getCacheVersion` [#1378](https://github.com/actions/toolkit/pull/1378) - Fixed a bug that mutated path arguments to `getCacheVersion` [#1378](https://github.com/actions/toolkit/pull/1378)
### 3.2.2 ## 3.2.2
- Add new default cache download method to improve performance and reduce hangs [#1484](https://github.com/actions/toolkit/pull/1484) - Add new default cache download method to improve performance and reduce hangs [#1484](https://github.com/actions/toolkit/pull/1484)
### 3.2.1 ## 3.2.1
- Updated @azure/storage-blob to `v12.13.0` - Updated @azure/storage-blob to `v12.13.0`
### 3.2.0 ## 3.2.0
- Add `lookupOnly` to cache restore `DownloadOptions`. - Add `lookupOnly` to cache restore `DownloadOptions`.
### 3.1.4 ## 3.1.4
- Fix zstd not being used due to `zstd --version` output change in zstd 1.5.4 release. See [#1353](https://github.com/actions/toolkit/pull/1353). - Fix zstd not being used due to `zstd --version` output change in zstd 1.5.4 release. See [#1353](https://github.com/actions/toolkit/pull/1353).
### 3.1.3 ## 3.1.3
- Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329). - Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329).
### 3.1.2 ## 3.1.2
- Fix issue with symlink restoration on windows. - Fix issue with symlink restoration on windows.
### 3.1.1 ## 3.1.1
- Reverted changes in 3.1.0 to fix issue with symlink restoration on windows. - Reverted changes in 3.1.0 to fix issue with symlink restoration on windows.
- Added support for verbose logging about cache version during cache miss. - Added support for verbose logging about cache version during cache miss.
### 3.1.0 ## 3.1.0
- Update actions/cache on windows to use gnu tar and zstd by default - Update actions/cache on windows to use gnu tar and zstd by default
- Update actions/cache on windows to fallback to bsdtar and zstd if gnu tar is not available. - Update actions/cache on windows to fallback to bsdtar and zstd if gnu tar is not available.
- Added support for fallback to gzip to restore old caches on windows. - Added support for fallback to gzip to restore old caches on windows.
### 3.1.0-beta.3 ## 3.1.0-beta.3
- Bug Fixes for fallback to gzip to restore old caches on windows and bsdtar if gnutar is not available. - Bug Fixes for fallback to gzip to restore old caches on windows and bsdtar if gnutar is not available.
### 3.1.0-beta.2 ## 3.1.0-beta.2
- Added support for fallback to gzip to restore old caches on windows. - Added support for fallback to gzip to restore old caches on windows.
### 3.0.6 ## 3.0.6
- Added `@azure/abort-controller` to dependencies to fix compatibility issue with ESM [#1208](https://github.com/actions/toolkit/issues/1208) - Added `@azure/abort-controller` to dependencies to fix compatibility issue with ESM [#1208](https://github.com/actions/toolkit/issues/1208)
### 3.0.5 ## 3.0.5
- Update `@actions/cache` to use `@actions/core@^1.10.0` - Update `@actions/cache` to use `@actions/core@^1.10.0`
### 3.0.4 ## 3.0.4
- Fix zstd not working for windows on gnu tar in issues [#888](https://github.com/actions/cache/issues/888) and [#891](https://github.com/actions/cache/issues/891). - Fix zstd not working for windows on gnu tar in issues [#888](https://github.com/actions/cache/issues/888) and [#891](https://github.com/actions/cache/issues/891).
- Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MINS`. Default is 60 minutes. - Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MINS`. Default is 60 minutes.
### 3.0.3 ## 3.0.3
- Bug fixes for download stuck issue [#810](https://github.com/actions/cache/issues/810). - Bug fixes for download stuck issue [#810](https://github.com/actions/cache/issues/810).
### 3.0.2 ## 3.0.2
- Added 1 hour timeout for the download stuck issue [#810](https://github.com/actions/cache/issues/810). - Added 1 hour timeout for the download stuck issue [#810](https://github.com/actions/cache/issues/810).
### 3.0.1 ## 3.0.1
- Fix [#833](https://github.com/actions/cache/issues/833) - cache doesn't work with github workspace directory. - Fix [#833](https://github.com/actions/cache/issues/833) - cache doesn't work with github workspace directory.
- Fix [#809](https://github.com/actions/cache/issues/809) `zstd -d: no such file or directory` error on AWS self-hosted runners. - Fix [#809](https://github.com/actions/cache/issues/809) `zstd -d: no such file or directory` error on AWS self-hosted runners.
### 3.0.0 ## 3.0.0
- Updated actions/cache to suppress Actions cache server error and log warning for those error [#1122](https://github.com/actions/toolkit/pull/1122) - Updated actions/cache to suppress Actions cache server error and log warning for those error [#1122](https://github.com/actions/toolkit/pull/1122)
### 2.0.6 ## 2.0.6
- Fix `Tar failed with error: The process '/usr/bin/tar' failed with exit code 1` issue when temp directory where tar is getting created is actually the subdirectory of the path mentioned by the user for caching. ([issue](https://github.com/actions/cache/issues/689)) - Fix `Tar failed with error: The process '/usr/bin/tar' failed with exit code 1` issue when temp directory where tar is getting created is actually the subdirectory of the path mentioned by the user for caching. ([issue](https://github.com/actions/cache/issues/689))
### 2.0.5 ## 2.0.5
- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) - Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624))
### 2.0.4 ## 2.0.4
- Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087) - Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087)
### 2.0.3 ## 2.0.3
- Update to v2.0.0 of `@actions/http-client` - Update to v2.0.0 of `@actions/http-client`
### 2.0.0 ## 2.0.0
- Added support to check if Actions cache service feature is available or not [#1028](https://github.com/actions/toolkit/pull/1028) - Added support to check if Actions cache service feature is available or not [#1028](https://github.com/actions/toolkit/pull/1028)
### 1.0.11 ## 1.0.11
- Fix file downloads > 2GB([issue](https://github.com/actions/cache/issues/773)) - Fix file downloads > 2GB([issue](https://github.com/actions/cache/issues/773))
### 1.0.10 ## 1.0.10
- Update `lockfileVersion` to `v2` in `package-lock.json [#1022](https://github.com/actions/toolkit/pull/1022) - Update `lockfileVersion` to `v2` in `package-lock.json [#1022](https://github.com/actions/toolkit/pull/1022)
### 1.0.9 ## 1.0.9
- Use @azure/ms-rest-js v2.6.0 - Use @azure/ms-rest-js v2.6.0
- Use @azure/storage-blob v12.8.0 - Use @azure/storage-blob v12.8.0
### 1.0.8 ## 1.0.8
- Increase the allowed artifact cache size from 5GB to 10GB ([issue](https://github.com/actions/cache/discussions/497)) - Increase the allowed artifact cache size from 5GB to 10GB ([issue](https://github.com/actions/cache/discussions/497))
### 1.0.7 ## 1.0.7
- Fixes permissions issue extracting archives with GNU tar on macOS ([issue](https://github.com/actions/cache/issues/527)) - Fixes permissions issue extracting archives with GNU tar on macOS ([issue](https://github.com/actions/cache/issues/527))
### 1.0.6 ## 1.0.6
- Make caching more verbose [#650](https://github.com/actions/toolkit/pull/650) - Make caching more verbose [#650](https://github.com/actions/toolkit/pull/650)
- Use GNU tar on macOS if available [#701](https://github.com/actions/toolkit/pull/701) - Use GNU tar on macOS if available [#701](https://github.com/actions/toolkit/pull/701)
### 1.0.5 ## 1.0.5
- Fix to ensure Windows cache paths get resolved correctly - Fix to ensure Windows cache paths get resolved correctly
### 1.0.4 ## 1.0.4
- Use @actions/core v1.2.6 - Use @actions/core v1.2.6
- Fixes uploadChunk to throw an error if any unsuccessful response code is received - Fixes uploadChunk to throw an error if any unsuccessful response code is received
### 1.0.3 ## 1.0.3
- Use http-client v1.0.9 - Use http-client v1.0.9
- Fixes error handling so retries are not attempted on non-retryable errors (409 Conflict, for example) - Fixes error handling so retries are not attempted on non-retryable errors (409 Conflict, for example)
- Adds 5 second delay between retry attempts - Adds 5 second delay between retry attempts
### 1.0.2 ## 1.0.2
- Use posix archive format to add support for some tools - Use posix archive format to add support for some tools
### 1.0.1 ## 1.0.1
- Fix bug in downloading large files (> 2 GBs) with the Azure SDK - Fix bug in downloading large files (> 2 GBs) with the Azure SDK
### 1.0.0 ## 1.0.0
- Downloads Azure-hosted caches using the Azure SDK for speed and reliability - Downloads Azure-hosted caches using the Azure SDK for speed and reliability
- Displays download progress - Displays download progress
- Includes changes that break compatibility with earlier versions, including: - Includes changes that break compatibility with earlier versions, including:
- `retry`, `retryTypedResponse`, and `retryHttpClientResponse` moved from `cacheHttpClient` to `requestUtils` - `retry`, `retryTypedResponse`, and `retryHttpClientResponse` moved from `cacheHttpClient` to `requestUtils`
### 0.2.1 ## 0.2.1
- Fix to await async function getCompressionMethod - Fix to await async function getCompressionMethod
### 0.2.0 ## 0.2.0
- Fixes issues with the zstd compression algorithm on Windows and Ubuntu 16.04 [#469](https://github.com/actions/toolkit/pull/469) - Fixes issues with the zstd compression algorithm on Windows and Ubuntu 16.04 [#469](https://github.com/actions/toolkit/pull/469)
### 0.1.0 ## 0.1.0
- Initial release - Initial release
+1 -1
View File
@@ -1,5 +1,5 @@
name: 'Set env variables' name: 'Set env variables'
description: 'Sets certain env variables so that e2e restore and save cache can be tested in a shell' description: 'Sets certain env variables so that e2e restore and save cache can be tested in a shell'
runs: runs:
using: 'node12' using: 'node20'
main: 'index.js' main: 'index.js'
+4 -3
View File
@@ -1,8 +1,9 @@
// Certain env variables are not set by default in a shell context and are only available in a node context from a running action // Certain env variables are not set by default in a shell context and are only available in a node context from a running action
// In order to be able to restore and save cache e2e in a shell when running CI tests, we need these env variables set // In order to be able to restore and save cache e2e in a shell when running CI tests, we need these env variables set
const fs = require('fs'); import fs from 'fs'
const os = require('os'); import os from 'os'
const filePath = process.env[`GITHUB_ENV`]
const filePath = process.env['GITHUB_ENV']
fs.appendFileSync(filePath, `ACTIONS_CACHE_SERVICE_V2=true${os.EOL}`, { fs.appendFileSync(filePath, `ACTIONS_CACHE_SERVICE_V2=true${os.EOL}`, {
encoding: 'utf8' encoding: 'utf8'
}) })
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env node
// Helper script to restore cache for e2e testing
import * as cache from '../lib/cache.js'
const [prefix, runId, useAzureSdk] = process.argv.slice(2)
if (!prefix || !runId) {
console.error('Usage: restore-cache.mjs <prefix> <runId> [useAzureSdk]')
process.exit(1)
}
const key = `test-${prefix}-${runId}`
const paths = ['test-cache', '~/test-cache']
const options = {useAzureSdk: useAzureSdk !== 'false'}
console.log(`Restoring cache with key: ${key}`)
console.log(`Paths: ${paths.join(', ')}`)
console.log(`Using Azure SDK: ${options.useAzureSdk}`)
const maxRetries = 3
const retryDelayMs = 5000
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
console.log(`Attempt ${attempt} of ${maxRetries}`)
const restoredKey = await cache.restoreCache(paths, key, [], options)
if (restoredKey) {
console.log(`Cache restored with key: ${restoredKey}`)
process.exit(0)
} else {
console.log('Cache not found on this attempt')
}
} catch (error) {
console.error(`Error on attempt ${attempt}:`, error.message)
}
if (attempt < maxRetries) {
console.log(`Waiting ${retryDelayMs / 1000}s before retry...`)
await new Promise(resolve => setTimeout(resolve, retryDelayMs))
}
}
console.error(`Failed to restore cache after ${maxRetries} attempts`)
process.exit(1)
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env node
// Helper script to save cache for e2e testing
import * as cache from '../lib/cache.js'
const [prefix, runId] = process.argv.slice(2)
if (!prefix || !runId) {
console.error('Usage: save-cache.mjs <prefix> <runId>')
process.exit(1)
}
const key = `test-${prefix}-${runId}`
const paths = ['test-cache', '~/test-cache']
console.log(`Saving cache with key: ${key}`)
console.log(`Paths: ${paths.join(', ')}`)
try {
const cacheId = await cache.saveCache(paths, key)
console.log(`Cache saved with ID: ${cacheId}`)
} catch (error) {
console.error('Error saving cache:', error)
process.exit(1)
}
+63 -157
View File
@@ -1,96 +1,86 @@
{ {
"name": "@actions/cache", "name": "@actions/cache",
"version": "5.0.5", "version": "6.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@actions/cache", "name": "@actions/cache",
"version": "5.0.5", "version": "6.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^2.0.0", "@actions/core": "^3.0.0",
"@actions/exec": "^2.0.0", "@actions/exec": "^3.0.0",
"@actions/glob": "^0.5.1", "@actions/glob": "^0.6.1",
"@actions/http-client": "^3.0.2", "@actions/http-client": "^4.0.0",
"@actions/io": "^2.0.0", "@actions/io": "^3.0.0",
"@azure/abort-controller": "^1.1.0",
"@azure/core-rest-pipeline": "^1.22.0", "@azure/core-rest-pipeline": "^1.22.0",
"@azure/storage-blob": "^12.29.1", "@azure/storage-blob": "^12.30.0",
"@protobuf-ts/runtime-rpc": "^2.11.1", "@protobuf-ts/runtime-rpc": "^2.11.1",
"semver": "^6.3.1" "semver": "^7.7.3"
}, },
"devDependencies": { "devDependencies": {
"@protobuf-ts/plugin": "^2.9.4", "@protobuf-ts/plugin": "^2.9.4",
"@types/node": "^24.1.0", "@types/node": "^25.1.0",
"@types/semver": "^6.0.0", "@types/semver": "^7.7.1",
"typescript": "^5.2.2" "typescript": "^5.2.2"
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "2.0.3", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-2.0.3.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.0.tgz",
"integrity": "sha512-Od9Thc3T1mQJYddvVPM4QGiLUewdh+3txmDYHHxoNdkqysR1MbCT+rFOtNUxYAz+7+6RIsqipVahY2GJqGPyxA==", "integrity": "sha512-zYt6cz+ivnTmiT/ksRVriMBOiuoUpDCJJlZ5KPl2/FRdvwU3f7MPh9qftvbkXJThragzUZieit2nyHUyw53Seg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/exec": "^2.0.0", "@actions/exec": "^3.0.0",
"@actions/http-client": "^3.0.2" "@actions/http-client": "^4.0.0"
} }
}, },
"node_modules/@actions/exec": { "node_modules/@actions/exec": {
"version": "2.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-2.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-3.0.0.tgz",
"integrity": "sha512-k8ngrX2voJ/RIN6r9xB82NVqKpnMRtxDoiO+g3olkIUpQNqjArXrCQceduQZCQj3P3xm32pChRLqRrtXTlqhIw==", "integrity": "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/io": "^2.0.0" "@actions/io": "^3.0.2"
} }
}, },
"node_modules/@actions/glob": { "node_modules/@actions/glob": {
"version": "0.5.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.1.tgz", "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.6.1.tgz",
"integrity": "sha512-+dv/t2aKQdKp9WWSp+1yIXVJzH5Q38M0Mta26pzIbeec14EcIleMB7UU6N7sNgbEuYfyuVGpE5pOKjl6j1WXkA==", "integrity": "sha512-K4+2Ac5ILcf2ySdJCha+Pop9NcKjxqCL4xL4zI50dgB2PbXgC0+AcP011xfH4Of6b4QEJJg8dyZYv7zl4byTsw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^2.0.3", "@actions/core": "^3.0.0",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
} }
}, },
"node_modules/@actions/http-client": { "node_modules/@actions/http-client": {
"version": "3.0.2", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.2.tgz", "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz",
"integrity": "sha512-JP38FYYpyqvUsz+Igqlc/JG6YO9PaKuvqjM3iGvaLqFnJ7TFmcLyy2IDrY0bI0qCQug8E9K+elv5ZNfw62ZJzA==", "integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"undici": "^6.23.0" "undici": "^6.23.0"
} }
}, },
"node_modules/@actions/http-client/node_modules/undici": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
"license": "MIT",
"engines": {
"node": ">=18.17"
}
},
"node_modules/@actions/io": { "node_modules/@actions/io": {
"version": "2.0.0", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-2.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/io/-/io-3.0.2.tgz",
"integrity": "sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg==", "integrity": "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@azure/abort-controller": { "node_modules/@azure/abort-controller": {
"version": "1.1.0", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-TrRLIoSQVzfAJX9H1JeFjzAoDGcoK1IYX1UImfceTZpsyYfWr09Ss1aHW1y5TrrR3iq6RZLBwJ3E24uwPhwahw==", "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tslib": "^2.2.0" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=12.0.0" "node": ">=18.0.0"
} }
}, },
"node_modules/@azure/core-auth": { "node_modules/@azure/core-auth": {
@@ -107,18 +97,6 @@
"node": ">=20.0.0" "node": ">=20.0.0"
} }
}, },
"node_modules/@azure/core-auth/node_modules/@azure/abort-controller": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@azure/core-client": { "node_modules/@azure/core-client": {
"version": "1.10.1", "version": "1.10.1",
"resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.10.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.10.1.tgz",
@@ -137,18 +115,6 @@
"node": ">=20.0.0" "node": ">=20.0.0"
} }
}, },
"node_modules/@azure/core-client/node_modules/@azure/abort-controller": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@azure/core-http-compat": { "node_modules/@azure/core-http-compat": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/@azure/core-http-compat/-/core-http-compat-2.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http-compat/-/core-http-compat-2.3.1.tgz",
@@ -163,18 +129,6 @@
"node": ">=20.0.0" "node": ">=20.0.0"
} }
}, },
"node_modules/@azure/core-http-compat/node_modules/@azure/abort-controller": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@azure/core-lro": { "node_modules/@azure/core-lro": {
"version": "2.7.2", "version": "2.7.2",
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.7.2.tgz", "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.7.2.tgz",
@@ -190,18 +144,6 @@
"node": ">=18.0.0" "node": ">=18.0.0"
} }
}, },
"node_modules/@azure/core-lro/node_modules/@azure/abort-controller": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@azure/core-paging": { "node_modules/@azure/core-paging": {
"version": "1.6.2", "version": "1.6.2",
"resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.6.2.tgz", "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.6.2.tgz",
@@ -232,18 +174,6 @@
"node": ">=20.0.0" "node": ">=20.0.0"
} }
}, },
"node_modules/@azure/core-rest-pipeline/node_modules/@azure/abort-controller": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@azure/core-tracing": { "node_modules/@azure/core-tracing": {
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.3.1.tgz",
@@ -270,18 +200,6 @@
"node": ">=20.0.0" "node": ">=20.0.0"
} }
}, },
"node_modules/@azure/core-util/node_modules/@azure/abort-controller": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@azure/core-xml": { "node_modules/@azure/core-xml": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/@azure/core-xml/-/core-xml-1.5.0.tgz", "resolved": "https://registry.npmjs.org/@azure/core-xml/-/core-xml-1.5.0.tgz",
@@ -309,9 +227,9 @@
} }
}, },
"node_modules/@azure/storage-blob": { "node_modules/@azure/storage-blob": {
"version": "12.29.1", "version": "12.30.0",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.29.1.tgz", "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.30.0.tgz",
"integrity": "sha512-7ktyY0rfTM0vo7HvtK6E3UvYnI9qfd6Oz6z/+92VhGRveWng3kJwMKeUpqmW/NmwcDNbxHpSlldG+vsUnRFnBg==", "integrity": "sha512-peDCR8blSqhsAKDbpSP/o55S4sheNwSrblvCaHUZ5xUI73XA7ieUGGwrONgD/Fng0EoDe1VOa3fAQ7+WGB3Ocg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -325,7 +243,7 @@
"@azure/core-util": "^1.11.0", "@azure/core-util": "^1.11.0",
"@azure/core-xml": "^1.4.5", "@azure/core-xml": "^1.4.5",
"@azure/logger": "^1.1.4", "@azure/logger": "^1.1.4",
"@azure/storage-common": "^12.1.1", "@azure/storage-common": "^12.2.0",
"events": "^3.0.0", "events": "^3.0.0",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
@@ -333,22 +251,10 @@
"node": ">=20.0.0" "node": ">=20.0.0"
} }
}, },
"node_modules/@azure/storage-blob/node_modules/@azure/abort-controller": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@azure/storage-common": { "node_modules/@azure/storage-common": {
"version": "12.1.1", "version": "12.2.0",
"resolved": "https://registry.npmjs.org/@azure/storage-common/-/storage-common-12.1.1.tgz", "resolved": "https://registry.npmjs.org/@azure/storage-common/-/storage-common-12.2.0.tgz",
"integrity": "sha512-eIOH1pqFwI6UmVNnDQvmFeSg0XppuzDLFeUNO/Xht7ODAzRLgGDh7h550pSxoA+lPDxBl1+D2m/KG3jWzCUjTg==", "integrity": "sha512-YZLxiJ3vBAAnFbG3TFuAMUlxZRexjQX5JDQxOkFGb6e2TpoxH3xyHI6idsMe/QrWtj41U/KoqBxlayzhS+LlwA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -365,18 +271,6 @@
"node": ">=20.0.0" "node": ">=20.0.0"
} }
}, },
"node_modules/@azure/storage-common/node_modules/@azure/abort-controller": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@bufbuild/protobuf": { "node_modules/@bufbuild/protobuf": {
"version": "2.10.1", "version": "2.10.1",
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.10.1.tgz", "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.10.1.tgz",
@@ -469,9 +363,9 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "24.10.2", "version": "25.1.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-25.1.0.tgz",
"integrity": "sha512-WOhQTZ4G8xZ1tjJTvKOpyEVSGgOTvJAfDK3FNFgELyaTpzhdgHVHeqW8V+UJvzF5BT+/B54T/1S2K6gd9c7bbA==", "integrity": "sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -479,9 +373,9 @@
} }
}, },
"node_modules/@types/semver": { "node_modules/@types/semver": {
"version": "6.2.7", "version": "7.7.1",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-6.2.7.tgz", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.1.tgz",
"integrity": "sha512-blctEWbzUFzQx799RZjzzIdBJOXmE37YYEyDtKkx5Dg+V7o/zyyAxLPiI98A2jdTtDgxZleMdfV+7p8WbRJ1OQ==", "integrity": "sha512-FmgJfu+MOcQ370SD0ev7EI8TlCAfKYU+B4m5T3yXc1CiRN94g/SZPtsCkk506aUDtlMnFZvasDwHHUcZUEaYuA==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
@@ -632,12 +526,15 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "6.3.1", "version": "7.7.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",
"license": "ISC", "license": "ISC",
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
} }
}, },
"node_modules/strnum": { "node_modules/strnum": {
@@ -681,6 +578,15 @@
"node": ">=14.17" "node": ">=14.17"
} }
}, },
"node_modules/undici": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
"license": "MIT",
"engines": {
"node": ">=18.17"
}
},
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "7.16.0", "version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
+20 -15
View File
@@ -1,7 +1,6 @@
{ {
"name": "@actions/cache", "name": "@actions/cache",
"version": "5.0.5", "version": "6.0.0",
"preview": true,
"description": "Actions cache lib", "description": "Actions cache lib",
"keywords": [ "keywords": [
"github", "github",
@@ -10,8 +9,15 @@
], ],
"homepage": "https://github.com/actions/toolkit/tree/main/packages/cache", "homepage": "https://github.com/actions/toolkit/tree/main/packages/cache",
"license": "MIT", "license": "MIT",
"type": "module",
"main": "lib/cache.js", "main": "lib/cache.js",
"types": "lib/cache.d.ts", "types": "lib/cache.d.ts",
"exports": {
".": {
"types": "./lib/cache.d.ts",
"import": "./lib/cache.js"
}
},
"directories": { "directories": {
"lib": "lib", "lib": "lib",
"test": "__tests__" "test": "__tests__"
@@ -31,31 +37,30 @@
"scripts": { "scripts": {
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json", "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
"test": "echo \"Error: run tests from root\" && exit 1", "test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc" "tsc": "tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/"
}, },
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"
}, },
"dependencies": { "dependencies": {
"@actions/core": "^2.0.0", "@actions/core": "^3.0.0",
"@actions/exec": "^2.0.0", "@actions/exec": "^3.0.0",
"@actions/glob": "^0.5.1", "@actions/glob": "^0.6.1",
"@protobuf-ts/runtime-rpc": "^2.11.1", "@actions/http-client": "^4.0.0",
"@actions/http-client": "^3.0.2", "@actions/io": "^3.0.0",
"@actions/io": "^2.0.0",
"@azure/abort-controller": "^1.1.0",
"@azure/core-rest-pipeline": "^1.22.0", "@azure/core-rest-pipeline": "^1.22.0",
"@azure/storage-blob": "^12.29.1", "@azure/storage-blob": "^12.30.0",
"semver": "^6.3.1" "@protobuf-ts/runtime-rpc": "^2.11.1",
"semver": "^7.7.3"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^24.1.0",
"@types/semver": "^6.0.0",
"@protobuf-ts/plugin": "^2.9.4", "@protobuf-ts/plugin": "^2.9.4",
"@types/node": "^25.1.0",
"@types/semver": "^7.7.1",
"typescript": "^5.2.2" "typescript": "^5.2.2"
}, },
"overrides": { "overrides": {
"uri-js": "npm:uri-js-replace@^1.0.1", "uri-js": "npm:uri-js-replace@^1.0.1",
"node-fetch": "^3.3.2" "node-fetch": "^3.3.2"
} }
} }
+9 -7
View File
@@ -1,18 +1,20 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as path from 'path' import * as path from 'path'
import * as utils from './internal/cacheUtils' import * as utils from './internal/cacheUtils.js'
import * as cacheHttpClient from './internal/cacheHttpClient' import * as cacheHttpClient from './internal/cacheHttpClient.js'
import * as cacheTwirpClient from './internal/shared/cacheTwirpClient' import * as cacheTwirpClient from './internal/shared/cacheTwirpClient.js'
import {getCacheServiceVersion, isGhes} from './internal/config' import {getCacheServiceVersion, isGhes} from './internal/config.js'
import {DownloadOptions, UploadOptions} from './options' import {DownloadOptions, UploadOptions} from './options.js'
import {createTar, extractTar, listTar} from './internal/tar' import {createTar, extractTar, listTar} from './internal/tar.js'
import { import {
CreateCacheEntryRequest, CreateCacheEntryRequest,
FinalizeCacheEntryUploadRequest, FinalizeCacheEntryUploadRequest,
FinalizeCacheEntryUploadResponse, FinalizeCacheEntryUploadResponse,
GetCacheEntryDownloadURLRequest GetCacheEntryDownloadURLRequest
} from './generated/results/api/v1/cache' } from './generated/results/api/v1/cache.js'
import {HttpClientError} from '@actions/http-client' import {HttpClientError} from '@actions/http-client'
export type {DownloadOptions, UploadOptions}
export class ValidationError extends Error { export class ValidationError extends Error {
constructor(message: string) { constructor(message: string) {
super(message) super(message)
+1 -1
View File
@@ -12,7 +12,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime";
import { CacheMetadata } from "../../entities/v1/cachemetadata"; import { CacheMetadata } from "../../entities/v1/cachemetadata.js";
/** /**
* @generated from protobuf message github.actions.results.api.v1.CreateCacheEntryRequest * @generated from protobuf message github.actions.results.api.v1.CreateCacheEntryRequest
*/ */
@@ -5,7 +5,7 @@ import {
FinalizeCacheEntryUploadResponse, FinalizeCacheEntryUploadResponse,
GetCacheEntryDownloadURLRequest, GetCacheEntryDownloadURLRequest,
GetCacheEntryDownloadURLResponse, GetCacheEntryDownloadURLResponse,
} from "./cache"; } from "./cache.js";
//==================================// //==================================//
// Client Code // // Client Code //
@@ -11,7 +11,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime";
import { CacheScope } from "./cachescope"; import { CacheScope } from "./cachescope.js";
/** /**
* @generated from protobuf message github.actions.results.entities.v1.CacheMetadata * @generated from protobuf message github.actions.results.entities.v1.CacheMetadata
*/ */
+8 -8
View File
@@ -7,8 +7,8 @@ import {
} from '@actions/http-client/lib/interfaces' } from '@actions/http-client/lib/interfaces'
import * as fs from 'fs' import * as fs from 'fs'
import {URL} from 'url' import {URL} from 'url'
import * as utils from './cacheUtils' import * as utils from './cacheUtils.js'
import {uploadCacheArchiveSDK} from './uploadUtils' import {uploadCacheArchiveSDK} from './uploadUtils.js'
import { import {
ArtifactCacheEntry, ArtifactCacheEntry,
InternalCacheOptions, InternalCacheOptions,
@@ -17,25 +17,25 @@ import {
ReserveCacheResponse, ReserveCacheResponse,
ITypedResponseWithError, ITypedResponseWithError,
ArtifactCacheList ArtifactCacheList
} from './contracts' } from './contracts.js'
import { import {
downloadCacheHttpClient, downloadCacheHttpClient,
downloadCacheHttpClientConcurrent, downloadCacheHttpClientConcurrent,
downloadCacheStorageSDK downloadCacheStorageSDK
} from './downloadUtils' } from './downloadUtils.js'
import { import {
DownloadOptions, DownloadOptions,
UploadOptions, UploadOptions,
getDownloadOptions, getDownloadOptions,
getUploadOptions getUploadOptions
} from '../options' } from '../options.js'
import { import {
isSuccessStatusCode, isSuccessStatusCode,
retryHttpClientResponse, retryHttpClientResponse,
retryTypedResponse retryTypedResponse
} from './requestUtils' } from './requestUtils.js'
import {getCacheServiceURL} from './config' import {getCacheServiceURL} from './config.js'
import {getUserAgentString} from './shared/user-agent' import {getUserAgentString} from './shared/user-agent.js'
function getCacheApiUrl(resource: string): string { function getCacheApiUrl(resource: string): string {
const baseUrl: string = getCacheServiceURL() const baseUrl: string = getCacheServiceURL()
+1 -1
View File
@@ -11,7 +11,7 @@ import {
CacheFilename, CacheFilename,
CompressionMethod, CompressionMethod,
GnuTarPathOnWindows GnuTarPathOnWindows
} from './constants' } from './constants.js'
const versionSalt = '1.0' const versionSalt = '1.0'
@@ -1,4 +1,4 @@
import {CompressionMethod} from './constants' import {CompressionMethod} from './constants.js'
import {TypedResponse} from '@actions/http-client/lib/interfaces' import {TypedResponse} from '@actions/http-client/lib/interfaces'
import {HttpClientError} from '@actions/http-client' import {HttpClientError} from '@actions/http-client'
+4 -6
View File
@@ -7,12 +7,10 @@ import * as fs from 'fs'
import * as stream from 'stream' import * as stream from 'stream'
import * as util from 'util' import * as util from 'util'
import * as utils from './cacheUtils' import * as utils from './cacheUtils.js'
import {SocketTimeout} from './constants' import {SocketTimeout} from './constants.js'
import {DownloadOptions} from '../options' import {DownloadOptions} from '../options.js'
import {retryHttpClientResponse} from './requestUtils' import {retryHttpClientResponse} from './requestUtils.js'
import {AbortController} from '@azure/abort-controller'
/** /**
* Pipes the body of a HTTP response to a stream * Pipes the body of a HTTP response to a stream
+2 -2
View File
@@ -4,8 +4,8 @@ import {
HttpClientError, HttpClientError,
HttpClientResponse HttpClientResponse
} from '@actions/http-client' } from '@actions/http-client'
import {DefaultRetryDelay, DefaultRetryAttempts} from './constants' import {DefaultRetryDelay, DefaultRetryAttempts} from './constants.js'
import {ITypedResponseWithError} from './contracts' import {ITypedResponseWithError} from './contracts.js'
export function isSuccessStatusCode(statusCode?: number): boolean { export function isSuccessStatusCode(statusCode?: number): boolean {
if (!statusCode) { if (!statusCode) {
+6 -6
View File
@@ -1,12 +1,12 @@
import {info, debug, warning} from '@actions/core' import {info, debug, warning} from '@actions/core'
import {getUserAgentString} from './user-agent' import {getUserAgentString} from './user-agent.js'
import {NetworkError, RateLimitError, UsageError} from './errors' import {NetworkError, RateLimitError, UsageError} from './errors.js'
import {getCacheServiceURL} from '../config' import {getCacheServiceURL} from '../config.js'
import {getRuntimeToken} from '../cacheUtils' import {getRuntimeToken} from '../cacheUtils.js'
import {BearerCredentialHandler} from '@actions/http-client/lib/auth' import {BearerCredentialHandler} from '@actions/http-client/lib/auth'
import {HttpClient, HttpClientResponse, HttpCodes} from '@actions/http-client' import {HttpClient, HttpClientResponse, HttpCodes} from '@actions/http-client'
import {CacheServiceClientJSON} from '../../generated/results/api/v1/cache.twirp-client' import {CacheServiceClientJSON} from '../../generated/results/api/v1/cache.twirp-client.js'
import {maskSecretUrls} from './util' import {maskSecretUrls} from './util.js'
// The twirp http client must implement this interface // The twirp http client must implement this interface
interface Rpc { interface Rpc {
@@ -0,0 +1,7 @@
// This file exists as a CommonJS module to read the version from package.json.
// In an ESM package, using `require()` directly in .ts files requires disabling
// ESLint rules and doesn't work reliably across all Node.js versions.
// By keeping this as a .cjs file, we can use require() naturally and export
// the version for the ESM modules to import.
const packageJson = require('../../../package.json')
module.exports = { version: packageJson.version }
+2 -3
View File
@@ -1,9 +1,8 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports import {version} from './package-version.cjs'
const packageJson = require('../../../package.json')
/** /**
* Ensure that this User Agent String is used in all HTTP calls so that we can monitor telemetry between different versions of this package * Ensure that this User Agent String is used in all HTTP calls so that we can monitor telemetry between different versions of this package
*/ */
export function getUserAgentString(): string { export function getUserAgentString(): string {
return `@actions/cache-${packageJson.version}` return `@actions/cache-${version}`
} }
+3 -3
View File
@@ -2,15 +2,15 @@ import {exec} from '@actions/exec'
import * as io from '@actions/io' import * as io from '@actions/io'
import {existsSync, writeFileSync} from 'fs' import {existsSync, writeFileSync} from 'fs'
import * as path from 'path' import * as path from 'path'
import * as utils from './cacheUtils' import * as utils from './cacheUtils.js'
import {ArchiveTool} from './contracts' import {ArchiveTool} from './contracts.js'
import { import {
CompressionMethod, CompressionMethod,
SystemTarPathOnWindows, SystemTarPathOnWindows,
ArchiveToolType, ArchiveToolType,
TarFilename, TarFilename,
ManifestFilename ManifestFilename
} from './constants' } from './constants.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
+2 -2
View File
@@ -6,8 +6,8 @@ import {
BlockBlobParallelUploadOptions BlockBlobParallelUploadOptions
} from '@azure/storage-blob' } from '@azure/storage-blob'
import {TransferProgressEvent} from '@azure/core-rest-pipeline' import {TransferProgressEvent} from '@azure/core-rest-pipeline'
import {InvalidResponseError} from './shared/errors' import {InvalidResponseError} from './shared/errors.js'
import {UploadOptions} from '../options' import {UploadOptions} from '../options.js'
/** /**
* Class for tracking the upload state and displaying stats. * Class for tracking the upload state and displaying stats.
+2
View File
@@ -4,6 +4,8 @@
"baseUrl": "./", "baseUrl": "./",
"outDir": "./lib", "outDir": "./lib",
"rootDir": "./src", "rootDir": "./src",
"module": "node16",
"moduleResolution": "node16",
"lib": [ "lib": [
"es6", "es6",
"dom" "dom"