mirror of
https://gitea.com/actions/setup-deno.git
synced 2025-12-14 20:36:42 +00:00
feat: include a hash of deno.lock files in the cache key automatically (#98)
This commit is contained in:
28
README.md
28
README.md
@@ -144,20 +144,38 @@ number.
|
||||
|
||||
### Caching dependencies downloaded by Deno automatically
|
||||
|
||||
Dependencies installed by Deno can be cached automatically, which is similar to
|
||||
the [`cache` option in `setup-node`](https://github.com/actions/setup-node).
|
||||
Dependencies installed by Deno can be cached automatically between workflow
|
||||
runs. This helps make your GH action run faster by not repeating caching work
|
||||
and network requests done by a previous run.
|
||||
|
||||
To enable the cache, use `cache: true`. It's recommended to also add the
|
||||
`cache-hash` property, to scope caches based on lockfile changes.
|
||||
To enable the cache, use `cache: true`.
|
||||
|
||||
```yaml
|
||||
- uses: denoland/setup-deno@v2
|
||||
with:
|
||||
cache: true
|
||||
cache-hash: ${{ hashFiles('**/deno.lock') }}
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> If an environment variable `DENO_DIR` is set for steps that run/download
|
||||
> dependencies, then `DENO_DIR` must also be set for the `denoland/setup-deno`
|
||||
> action, for the caching to work as intended.
|
||||
|
||||
By default, the cache is automatically keyed by:
|
||||
|
||||
- the github
|
||||
[job_id](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_id)
|
||||
- the runner os and architecture
|
||||
- a hash of the `deno.lock` files in the project
|
||||
|
||||
It is possible to customize the default hash
|
||||
(`${{ hashFiles('**/deno.lock') }}`) used as part of the cache key via the
|
||||
`cache-hash` input.
|
||||
|
||||
```yaml
|
||||
- uses: denoland/setup-deno@v2
|
||||
with:
|
||||
# setting `cache-hash` implies `cache: true` and will replace
|
||||
# the default cache-hash of `${{ hashFiles('**/deno.lock') }}`
|
||||
cache-hash: ${{ hashFiles('**/deno.json') }}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user