Skip to content

Reset UV_CACHE_DIR to prior value after action completion #181

@jamesbraza

Description

@jamesbraza

With a GitHub Action like the below:

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: astral-sh/setup-uv@v6
        with:
          enable-cache: true
      - uses: hynek/build-and-inspect-python-package@v2
      - run: uv sync # Uses /tmp/baipp-uv_cache_dir, not /home/runner/work/_temp/setup-uv-cache

One can hit an issue where:

  1. https://github.com/astral-sh/setup-uv's usage of enable-cache arg will set UV_CACHE_DIR to /home/runner/work/_temp/setup-uv-cache
  2. BAIPP will set UV_CACHE_DIR to /tmp/baipp-uv_cache_dir (link), clobbering setup-uv's UV_CACHE_DIR
  3. The post-run of setup-uv will fail:
Post job cleanup.
Pruning cache...
Saving cache path: /home/runner/work/_temp/setup-uv-cache
Error: Cache path /home/runner/work/_temp/setup-uv-cache does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.

I am thinking BAIPP should not have side effects such as changing UV_CACHE_DIR.

If there's a conflict in an environment variable, does it make sense for BAIPP to either:

  • Warn about clobbered env vars
  • Reset $GITHUB_ENV env vars to prior values

I am coming from astral-sh/setup-uv#592

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions