Skip to content

Commit

Permalink
refactor: address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Jul 10, 2024
1 parent e322719 commit 17ff7c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,17 @@ Internally, the GitHub Actions function `hashFiles` is used to hash the passed p

Using this with a fully pinned `requirements.txt` file is the most efficient use of this action because it automatically invalidates the cache.

#### `use-cache`

This defaults to `true`, but can be used to disable the cache, since GitHub's
default caching speed is slower than uv in many cases. For example, if you have
dependencies that don't provide prebuilt PyPy wheels, you can only cache that
run like this:
#### `if-use-cache`

This defaults to `true`, but can be used to disable the cache, since GitHub's default caching speed is slower than uv in many cases.
For example, if you have dependencies that don't provide prebuilt PyPy wheels, you can only cache that run like this:

```yaml
# ...
- uses: hynek/setup-cached-uv@v1
with:
use-cache: ${{ startsWith(matrix.python-version, 'pypy') }}
if-use-cache: ${{ startsWith(matrix.python-version, 'pypy') }}
# ...
```

Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ inputs:
required: false
default: ""

use-cache:
use-cache-if:
description: Save the cache.
required: false
default: true
Expand Down Expand Up @@ -46,11 +46,11 @@ runs:
"HASH_CACHE_SUFFIX=-${{ hashFiles(inputs.cache-dependency-path) }}"
>>$GITHUB_ENV
shell: bash
if: inputs.cache-dependency-path != '' && inputs.use-cache == 'true'
if: inputs.cache-dependency-path != '' && inputs.use-cache-if == 'true'

- name: Load uv cache
uses: actions/cache@v4
if: inputs.use-cache == 'true'
if: inputs.use-cache-if == 'true'
with:
path: ${{ env.UV_CACHE }}
key: uv-${{ runner.os }}${{ inputs.cache-suffix }}${{ env.HASH_CACHE_SUFFIX }}

0 comments on commit 17ff7c1

Please sign in to comment.