Merge branch 'main' into fix-typo

This commit is contained in:
Josh Gross 2024-10-03 14:55:06 -04:00 committed by GitHub
commit 2f639c1c1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 66 additions and 34 deletions

View file

@ -243,24 +243,7 @@ with:
### Saving cache even if the build fails
There can be cases where a cache should be saved even if the build job fails. For example, a job can fail due to flaky tests but the caches can still be re-used. You can use `actions/cache/save` action to save the cache by using `if: always()` condition.
Similarly, `actions/cache/save` action can be conditionally used based on the output of the previous steps. This way you get more control on when to save the cache.
```yaml
steps:
- uses: actions/checkout@v4
.
. // restore if need be
.
- name: Build
run: /build.sh
- uses: actions/cache/save@v4
if: always() // or any other condition to invoke the save action
with:
path: path/to/dependencies
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
```
See [Always save cache](./save/README.md#always-save-cache).
### Saving cache once and reusing in multiple workflows