Commit Graph
24 Commits
Author SHA1 Message Date
36b7b57007 fix: only report a saved cache when saving succeeded (#1110)
## Summary

The post step logs `uv cache saved with key: ...` (and `Python cache
saved with key: ...`) even when the save failed. The log in #769 shows
it right after `Warning: Failed to save: ...`:

```
Warning: Failed to save: "C:\Program failed with error: The process 'C:\Program Files\Git\usr\bin\tar.exe' failed with exit code 2
uv cache saved with key: setup-uv-2-x86_64-pc-windows-msvc-windows-11-3.12.12-pruned-...
```

`@actions/cache`'s `saveCache` doesn't throw for these failures. It logs
them and returns `-1`, and `saveCacheToKey` ignored the return value.
This now checks for `-1` before logging, which is the same check the
`actions/cache` save step uses (`if (cacheId != -1) core.info("Cache
saved with key: ...")`). `@actions/cache` already logs the reason, so
nothing else is logged on failure, and the exit code stays the same.

This only changes the log line. It doesn't address the underlying
tar/gzip failure in #769. One limitation: with the legacy (v1) cache
service, an upload that fails after the cache was reserved still returns
the reserved id, so that one case is still reported as saved. That's on
the `@actions/cache` side and affects `actions/cache` the same way.

Related to #769

## Test plan

- Added `__tests__/cache/save-cache.test.ts`. The `-1` case fails before
the change and passes after it.
- `npm run all` on Ubuntu (WSL) with Node 24.19.0 / npm 11.17.0: build,
Biome (no fixes), packaging, and all 161 tests across 16 suites pass.
The regenerated `dist/save-cache/index.cjs` only differs in the changed
lines.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:38:39 +01:00
Kevin StillhammerandGitHub a92cb43098 Add quiet input to suppress info-level log output (#898)
## Summary

Adds a new `quiet` input (default: `false`) that suppresses `info`-level
log output when set to `true`. Only warnings and errors are shown.

Contributes to: #868
2026-05-31 21:13:30 +02:00
Kevin StillhammerandGitHub 818affc359 fix: report unexpected cache save failures (#896)
## Summary
- add top-level uncaughtException and unhandledRejection handlers for
the save-cache entrypoint
- report unexpected post-action failures through core.setFailed with
stack/context
- regenerate the committed save-cache bundle
2026-05-31 11:25:35 +02:00
Kevin StillhammerandGitHub 7568f55a9a increase libuv-workaround timeout to 100ms (#880)
This should fix
https://github.com/astral-sh/setup-uv/issues/686#issuecomment-4389301919
2026-05-13 08:28:39 +02:00
Kevin StillhammerandGitHub f82eb19c06 Refactor inputs (#823)
Don't load at import time and make it easier to test
2026-03-28 16:23:26 +01:00
Kevin StillhammerandGitHub 02182fa02a fix: warn instead of error when no python to cache (#762)
Fixes: #754
2026-02-06 16:00:33 +01:00
Kevin StillhammerandGitHub 61cb8a9741 add outputs python-version and python-cache-hit (#728)
This commit splits up the "normal" cache containing the dependencies and
the "python" cache containing the python binaries. This will lead to a
one-time invalidation of caches.

Closes: #713
2026-01-06 18:06:29 +01:00
Kevin StillhammerandGitHub 4180991cd9 allow cache-local-path w/o enable-cache (#707)
Fixes: #705
2025-12-07 17:52:54 +01:00
Kevin StillhammerandGitHub 1e862dfacb Wait 50ms before exit to fix libuv bug (#689)
Fixes: #686
2025-11-21 09:00:37 +01:00
Kevin StillhammerandGitHub d18bcc753a Add value of UV_PYTHON_INSTALL_DIR to path (#628)
Closes: #610
2025-10-11 18:42:06 +02:00
6d2eb15b49 Cache python installs (#621)
This pull request introduces support for caching Python installs in the
GitHub Action, allowing users to cache not only dependencies but also
the Python interpreter itself.

This works by setting the `UV_PYTHON_INSTALL_DIR` to a subdirectory of
the dependency cache path so that Python installs are directed there.

Fixes #135

---------

Co-authored-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
2025-10-09 22:47:24 +02:00
Kevin StillhammerandGitHub f610be5ff9 Use --force when pruning cache (#611)
To prevent waiting forever on other running uv processes
2025-10-07 09:42:14 +02:00
Kevin StillhammerandGitHub f2859da213 Respect UV_NO_MODIFY_PATH (#603)
Fixes: #519
2025-10-02 17:54:15 +02:00
James BrazaandGitHub f9c6974d8b Warn when UV_CACHE_DIR has changed (#601)
Closes https://github.com/astral-sh/setup-uv/issues/592
2025-10-02 17:50:15 +02:00
Kevin StillhammerandGitHub d0cc045d04 Always show prune cache output (#597) 2025-09-30 17:05:27 +02:00
Kevin StillhammerandGitHub dc724a12b6 Add inputs restore-cache and save-cache (#568)
Closes: #555
2025-09-14 14:55:08 +02:00
Kevin StillhammerandGitHub 4109b4033f Bump biome to v2 (#515) 2025-08-12 20:12:10 +00:00
Kevin StillhammerandGitHub ed171c292b Fail when cache local path does not exist when trying to cache (#163)
Can be disabled by setting `ignore-nothing-to-cache: true`
2024-11-23 16:30:54 +01:00
Kevin StillhammerandGitHub 9b71657bb2 Add comment to clarify process.exit(0) (#161)
Copied from https://github.com/actions/cache/pull/1217
2024-11-23 10:58:21 +00:00
3b9817b1bf feat: add option to disable cache pruning (#134)
This PR adds an input to control whether or not the cache is pruned
before saving.

Closes #122

---------

Co-authored-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
Co-authored-by: Charlie Marsh <crmarsh416@gmail.com>
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-10-25 14:11:32 +02:00
Charlie MarshandGitHub c11f8674f8 Migrate to Biome for linting and formatting (#107) 2024-09-30 08:55:24 +02:00
Charlie MarshandGitHub 182c9c7e92 Change Prettier settings (#36)
## Summary

I know this is a little tedious but I'd prefer to use the same settings
as in Ruff.
2024-09-05 08:06:45 -04:00
Kevin Stillhammer 332ac35295 Prune cache before saving 2024-08-24 10:08:12 +02:00
Kevin Stillhammer 18498fc78f Initial commit 2024-08-23 23:58:26 +02:00