Visitar URL original
Don't set `UV_CACHE_DIR` if `enable-cache` is `false` · Issue #583 · astral-sh/setup-uv · GitHub
Skip to content

Don't set UV_CACHE_DIR if enable-cache is false #583

Closed

Description

@danielrbradley

When the UV_CACHE_DIR environment variable is set, it takes precidence over the project-specific setting tool.uv.cache-dir. This makes it imossible to use this setup action when requiring custom cache configuration on a per-project basis. This is probably a niche requirement, but I'm personally using it while testing another tool's ability to correctly save and restore UV caches.

My expectation would be that explicitly disabling the cache by setting enable-cache: false would avoid setting this environment variable, but this is not the case as it's set unconditionally in the run function:

setCacheDir(cacheLocalPath);

It's currently not possible to unset an environment variable in GitHub actions (see: actions/runner#1126) so I don't think there's a workaround to allow projects to use their own cache directories.

Activity

  1. added theissue type on Sep 22, 2025
  2. eifinger commented on Sep 22, 2025

    @eifinger
    Collaborator

    We could add the functionality to look for configurations in the config files and only then apply defaults.
    Until then, as a workaround, can you use the cache-local-path input?

  3. danielrbradley commented on Sep 22, 2025

    @danielrbradley
    Author

    I don't think that'll work for us as it needs to be a different location for each test.

    I assume we can't just unset UV_CACHE_DIR as that might be a breaking change for existing users even if they're not using the cache themselves?

  4. eifinger commented on Sep 22, 2025

    @eifinger
    Collaborator

    If you set enable-cache: false then you can do whatever you want with UV_CACHE_DIR as this action won't rely on use it then

  5. added a commit that references this issue on Oct 7, 2025
    535dc26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions