Commit Graph
513 Commits
Author SHA1 Message Date
qmuntal da266fa6fd fix(cache): isolate Windows BSD tar temporary files
Run Windows BSD tar/zstd extraction and listing in private temporary
directories. Concurrent operations previously overwrote cache.tar in the
process working directory and could extract the wrong archive without
reporting an error. Debug listings during cache saves have the same race.

Resolve and quote archive and workspace paths before changing the child
working directory, and remove scratch files on success and failure.
Leave GNU tar, gzip, and the cache archive format unchanged.

Add deterministic regression tests for concurrent reads, relative paths
with spaces, and cleanup after failures in either subprocess.
2026-09-17 15:27:15 +02:00
Philip GaiandCopilot Autofix powered by AI 8d05a01e45 feat(cache): add cache-mode client behavior (read-denied warning + ACTIONS_CACHE_MODE skip) (#2447)
* feat(cache): surface cache read-denied as a distinct restore warning

Mirror the existing cache write-denied handling on the restore path. When
the receiver refuses a download URL because the run's token has no readable
cache scopes, it returns a twirp PermissionDenied (HTTP 403). The twirp
client wraps that 403 in a generic Error, so the stable 'cache read denied:'
prefix is embedded in the message rather than at the start.

- Add CACHE_READ_DENIED_PREFIX and CacheReadDeniedError
- Dispatch on the prefix in the restoreCacheV2 catch block (V2 only), log a
  policy-specific warning, and report a cache miss so the run continues
- Add a test mirroring the write-denied coverage

* chore(cache): trim comments, bump to 6.2.0, add RELEASES entry

* refactor(cache): dispatch read-denied by error name to mirror write path

Re-throw CacheReadDeniedError from an inner try/catch around
GetCacheEntryDownloadURL and dispatch on typedError.name in the outer catch,
matching how saveCacheV2 handles CacheWriteDeniedError.

* feat(cache): handle read-denied on the v1 restore path

Extend the read-denied handling to Cache Service v1 so GHES (which forces v1
via _apis/artifactcache) is covered when read-scope enforcement ships there.

- Surface the receiver's error body message from getCacheEntry instead of a
  generic status-code error, so the cache read denied: prefix reaches callers
- Re-throw CacheReadDeniedError from restoreCacheV1 and dispatch on it in the
  outer catch, mirroring restoreCacheV2 and the write-denied v1 handling
- Add a v1 read-denied test

* refactor(cache): only surface receiver body for read-denied on v1

* test(cache): assert getCacheEntry only surfaces body for read-denied

* test(cache): cover non-read-denied getCacheEntry passthrough on v1

* refactor(cache): share read-denied prefix via constants to avoid drift

* feat(cache): skip restore/save per ACTIONS_CACHE_MODE

* test(cache): expand ACTIONS_CACHE_MODE skip coverage across v1/v2 and unknown modes

* fix copilot pr feedback

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* docs(cache): remove internal reference from cache-mode comment

* test(cache): merge redundant cache-mode skip tests and simplify read-denied handling

Address PR review feedback:
- Merge the duplicate restore/save skip test.each blocks into single blocks parametrized over ACTIONS_CACHE_SERVICE_V2.
- Drop the redundant CacheReadDeniedError catch arms; the typed error is not an HttpClientError so it already falls through to a non-fatal warning.
- Clarify why read-denied classification happens both in getCacheEntry and cache.ts (dependency-free internal module cannot import the typed error).

* refactor(cache): drop redundant CacheWriteDeniedError catch arms

Mirror the read-denied simplification on the save path. CacheWriteDeniedError
is not an HttpClientError and its name does not match the ReserveCacheError
arm, so it falls through to the same non-fatal warning. Logging behavior is
unchanged (warns, never fails the run) and the exported type is still thrown
internally for consumers and tests. Also refresh stale doc wording.

* test(cache): collapse redundant restore getCacheEntry-failure tests

The two restoreCache tests exercised the identical warning + cache-miss path
now that read-denied is no longer reclassified in the catch, so merge them into
one. The read-denied prefix detection that actually branches on the message is
covered by getCacheEntry tests in cacheHttpClient.test.ts.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-13 10:03:16 -05:00
Jason Ginchereau 480b99fb38 Bump cache package to v6.1.0, update RELEASES.md (#2436) 2026-06-17 11:25:12 -10:00
Jason Ginchereau b175b31648 Handle cache write error due to read-only token 2026-06-16 08:03:28 -10:00
Jason Ginchereau 359fe7deed Audit fix packages/cache 2026-06-11 17:24:11 -07:00
Jason Ginchereau 66801604fb Adit fix, address copilot comments 2026-06-11 17:17:55 -07:00
Jason Ginchereau c99fedd87a Handle cache write error due to read-only token 2026-06-11 17:02:12 -07:00
Joshua Brooks 17c9708982 Merge pull request #2393 from actions/samirat/update_minor_dependency_versions
Update minor versions of cache and artifact dependencies
2026-05-07 15:59:39 -04:00
Joshua Brooks c2bd8f1a98 Bump toolkit version, add release notes 2026-05-01 17:38:16 +00:00
Joshua Brooks 692639d142 Audit npm packages 2026-05-01 16:33:28 +00:00
Joshua Brooks 1aafa41eea Update minor versions of cache and artifact dependencies 2026-05-01 16:27:55 +00:00
Zachary Taylor 0ed300edae Merge pull request #2323 from actions/zaataylor-update-artifact-storage-err-msg
Update artifact storage error message
2026-02-26 14:37:38 -05:00
Zachary Taylor c355f598ae Update UsageError in cache 2026-02-26 14:31:12 -05:00
Daniel Kennedy f0055b449b @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
2026-01-29 14:23:32 -05:00
Daniel Kennedy 298e1df765 Bump @actions/glob to 0.5.1 in @actions/cache 2026-01-27 15:43:44 -05:00
Daniel Kennedy b356064971 Bump @actions/http-client and @actions/github on all packages 2026-01-27 13:31:31 -05:00
Ryan Ghadimi 1a03c0e6e8 Merge pull request #2243 from GhadimiR/main
Don't retry 429s returned from the cache service
2026-01-16 10:43:35 +00:00
Ryan Ghadimi 1f51e29c64 Add comment for rate limiting handling
Added a comment regarding rate limiting and retry behavior.
2026-01-16 10:26:45 +00:00
Ryan GhadimiandBassem Dghaidi 84637c3cc0 Update packages/cache/RELEASES.md
Co-authored-by: Bassem Dghaidi <568794+Link-@users.noreply.github.com>
2026-01-16 10:25:44 +00:00
Ryan Ghadimi 5400c9e292 New error type for cache RL 2026-01-16 10:00:15 +00:00
Ryan Ghadimi 717aface57 update release doc 2026-01-16 09:51:21 +00:00
Ryan Ghadimi e3ebd136a4 bump pkg 2026-01-16 09:46:28 +00:00
Ryan Ghadimi 9dc746ecd2 tests & releases 2026-01-16 09:44:57 +00:00
Ryan Ghadimi a09633bc31 Add handling for 429s from cache service 2026-01-14 17:01:59 +00:00
copilot-swe-agent[bot]andTingluoHuang ad2490e451 Verify changes with tests - all package-specific tests passing
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
2026-01-07 22:03:56 +00:00
copilot-swe-agent[bot]andTingluoHuang c03ff60231 Update all packages to use @actions/http-client@^3.0.1 and bump patch versions
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
2026-01-07 21:55:41 +00:00
copilot-swe-agent[bot] 3eb780180a Initial plan 2026-01-07 21:51:58 +00:00
Tingluo Huang 7e40caef03 Merge pull request #2231 from actions/copilot/prepare-http-client-release
Release @actions/http-client v3.0.1
2026-01-07 15:35:32 -05:00
copilot-swe-agent[bot] 322682c900 Initial plan 2026-01-07 18:02:29 +00:00
Tingluo Huang b00d35a3d5 Merge pull request #2229 from actions/copilot/extend-user-agent-http-requests
Extend user-agent with orchestration ID and add default user-agent
2026-01-07 10:42:56 -05:00
copilot-swe-agent[bot]andTingluoHuang 5394209a56 Revert unrelated version bumps in package-lock.json files
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
2026-01-06 17:50:28 +00:00
copilot-swe-agent[bot]andTingluoHuang deca5e58a1 Add ACTIONS_ORCHESTRATION_ID support to http-client user-agent
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
2026-01-06 15:32:55 +00:00
Salman Muin Kayser Chishti e20f253477 docs(cache): add PR reference to v5.0.1 release notes 2025-12-12 14:53:26 +00:00
Salman Muin Kayser Chishti f3cf48186d Merge remote-tracking branch 'origin/main' into cache-v5.0.1-release 2025-12-12 14:50:27 +00:00
Salman Chishti 6203c81b11 Merge pull request #2213 from actions/fix-cache-storage-blob
fix(cache): update @azure/storage-blob to fix Node.js 24 punycode deprecation
2025-12-12 14:40:41 +00:00
Salman Muin Kayser Chishti 30a087c3c9 fix(cache): update @azure/storage-blob to ^12.29.1 to address punycode deprecation 2025-12-12 14:05:14 +00:00
Salman Muin Kayser Chishti 765c6a30ea docs(cache): bump to v5.0.1 and add release notes 2025-12-12 13:42:58 +00:00
Salman Muin Kayser Chishti 5571dcd36e fix(cache): update @azure/storage-blob to ^12.29.1 to fix punycode deprecation
- Updated @azure/storage-blob from ^12.13.0 to ^12.29.1
- Newer storage-blob uses @azure/core-rest-pipeline instead of deprecated @azure/core-http
- Fixes Node.js 24 deprecation warning for punycode module
2025-12-12 13:41:31 +00:00
Salman Chishti f82ab24b5c Merge pull request #2194 from actions/prepare-cache-release-v5.0.0
Prepare cache v5 release
2025-12-11 16:00:48 +00:00
Salman Muin Kayser Chishti 4b3724637e chore(releases): update release notes for v5.0.0 to remove punycode deprecation warning 2025-12-11 14:43:23 +00:00
Salman Muin Kayser Chishti bfe3eda47f PR number update in releases 2025-12-11 14:33:30 +00:00
Salman Muin Kayser Chishti 257f14d386 update releases 2025-12-11 14:32:58 +00:00
Salman Muin Kayser Chishti aaa311bbbf Merge remote-tracking branch 'origin/main' into prepare-cache-release-v5.0.0 2025-12-11 14:27:41 +00:00
Salman Chishti fe5dbb3c79 Merge pull request #2198 from actions/cache-bump-deps
chore(cache): bump @actions/* dependencies to v2/v3
2025-12-11 14:25:35 +00:00
Salman Muin Kayser Chishti 8ccf3832d9 chore(cache): update @actions/core to 2.0.1 2025-12-11 13:57:58 +00:00
Salman Muin Kayser Chishti 5e56f01027 update to core 2.0.1 which has exec 2.0.0 2025-12-11 13:54:17 +00:00
Salman Muin Kayser Chishti e9192e9660 chore(cache): bump @actions/* dependencies to v2/v3
- @actions/core: ^1.11.1 → ^2.0.0
- @actions/exec: ^1.0.1 → ^2.0.0
- @actions/glob: ^0.1.0 → ^0.5.0
- @actions/http-client: ^2.1.1 → ^3.0.0
- @actions/io: ^1.0.1 → ^2.0.0
2025-12-10 11:38:25 +00:00
Salman Chishti ffd76493fd Merge pull request #2197 from actions/cache-remove-ms-rest-js
fix(cache): replace @azure/ms-rest-js with @azure/core-rest-pipeline
2025-12-10 11:36:53 +00:00
Salman Muin Kayser Chishti bb06c8e35a fix(cache): replace @azure/ms-rest-js with @azure/core-rest-pipeline
Remove abandoned @azure/ms-rest-js dependency which pulls in node-fetch@v2, causing punycode deprecation warnings on Node.js 24+.

The TransferProgressEvent type is now imported from @azure/core-rest-pipeline instead.
2025-12-10 11:23:06 +00:00
Salman Muin Kayser Chishti f16ef58652 chore(cache): regenerate package-lock.json with Node 24 2025-12-10 11:09:56 +00:00