mirror of
https://github.com/actions/cache.git
synced 2025-06-24 19:31:10 +02:00
Compare commits
6 Commits
v3.2.1
...
phantsure/
Author | SHA1 | Date | |
---|---|---|---|
9ce89c57c5 | |||
d1507cccba | |||
3337563725 | |||
60c7666709 | |||
b053f2b699 | |||
501277cfd7 |
@ -245,8 +245,8 @@ Following are some of the known practices/workarounds which community has used t
|
||||
- [Cache segment restore timeout](./tips-and-workarounds.md#cache-segment-restore-timeout)
|
||||
- [Update a cache](./tips-and-workarounds.md#update-a-cache)
|
||||
- [Use cache across feature branches](./tips-and-workarounds.md#use-cache-across-feature-branches)
|
||||
- [Improving cache restore performance on Windows/Using cross-os caching](./tips-and-workarounds.md#improving-cache-restore-performance-on-windows-using-cross-os-caching)
|
||||
- [Force deletion of caches overriding default cache eviction policy](./tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy)
|
||||
- [Cross OS cache](./tips-and-workarounds.md#cross-os-cache)
|
||||
|
||||
#### Windows environment variables
|
||||
Please note that Windows environment variables (like `%LocalAppData%`) will NOT be expanded by this action. Instead, prefer using `~` in your paths which will expand to HOME directory. For example, instead of `%LocalAppData%`, use `~\AppData\Local`. For a list of supported default environment variables, see [this](https://docs.github.com/en/actions/learn-github-actions/environment-variables) page.
|
||||
|
@ -120,7 +120,7 @@ steps:
|
||||
|
||||
#### Reusing primary key and restored key in the save action
|
||||
|
||||
Usually you may want to use same `key` in both actions/cache/restore` and `actions/cache/save` action. To achieve this, use `outputs` from the restore action to reuse the same primary key (or the key of the cache that was restored).
|
||||
Usually you may want to use same `key` in both `actions/cache/restore` and `actions/cache/save` action. To achieve this, use `outputs` from the restore action to reuse the same primary key (or the key of the cache that was restored).
|
||||
|
||||
#### Using restore action outputs to make save action behave just like the cache action
|
||||
|
||||
|
@ -54,7 +54,7 @@ Case 1: Where an user would want to reuse the key as it is
|
||||
```yaml
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
key: steps.restore-cache.output.key
|
||||
key: ${{ steps.restore-cache.outputs.key }}
|
||||
```
|
||||
|
||||
Case 2: Where the user would want to re-evaluate the key
|
||||
|
@ -62,4 +62,10 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
</details>
|
||||
</details>
|
||||
|
||||
## Cross OS cache
|
||||
From `v3.2.1` cache is cross os compatible. This means that a cache created on `ubuntu-latest` can be used by `windows-latest` and vice versa. This is useful when you want to cache dependencies which is available on different the OSs. This will help reduce the consumption of the cache quota. Things to keep in mind:
|
||||
- Only cache those files which are compatible across OSs.
|
||||
- Don't cache symlinks as they work differently on different OSs so would cause issues during cache restore.
|
||||
- Put runner OS in the cache key if that cache is not ment to be used across OSs.
|
Reference in New Issue
Block a user