mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-23 20:19:16 +01:00
nit: added language to code blocks
This commit is contained in:
parent
da311f75a6
commit
05c9b49ea4
2 changed files with 9 additions and 9 deletions
|
@ -28,7 +28,7 @@ As this is a newly introduced action to give users more control in their workflo
|
|||
|
||||
In case you are using another workflow to create and save your cache that can be reused by other jobs in your repository, this action will take care of your restore only needs.
|
||||
|
||||
```
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
|
@ -57,7 +57,7 @@ In case of multi-module projects, where the built artifact of one project needs
|
|||
|
||||
|
||||
#### Step 1 - Build the parent module and save it
|
||||
```
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
|
@ -72,7 +72,7 @@ steps:
|
|||
```
|
||||
|
||||
#### Step 2 - Restore the built artifact from cache using the same key and path
|
||||
```
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
|
@ -97,7 +97,7 @@ steps:
|
|||
|
||||
You can use the output of this action to exit the workflow on cache miss. This way you can restrict your workflow to only initiate the build when `cache-hit` occurs, in other words, cache with exact key is found.
|
||||
|
||||
```
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ This action has no outputs.
|
|||
|
||||
In case you are using separate jobs for generating common artifacts and sharing them across different jobs, this action will help you with your save only needs.
|
||||
|
||||
```
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
|
@ -43,7 +43,7 @@ With save action, the key can now be re-evaluated while executing the action. Th
|
|||
|
||||
Let's say we have a restore step that computes key at runtime
|
||||
|
||||
```
|
||||
```yaml
|
||||
uses: actions/cache/restore@v3
|
||||
id: restore-cache
|
||||
with:
|
||||
|
@ -51,14 +51,14 @@ with:
|
|||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
Case 2: Where the user would want to re-evaluate the key
|
||||
```
|
||||
```yaml
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
key: npm-cache-${{hashfiles(package-lock.json)}}
|
||||
|
@ -68,7 +68,7 @@ with:
|
|||
|
||||
There are instances where some flaky test cases would fail the entire workflow and users would get frustrated because the builds would run for hours and the cache couldn't get saved as the workflow failed in between. For such use-cases, users would now have the ability to use `actions/cache/save` action to save the cache by using `if: always()` condition. This way the cache will always be saved if generated, or a warning will be thrown that nothing is found on the cache path. Users can also use the `if` condition to only execute the `actions/cache/save` action depending on the output of the previous steps. This way they get more control on when to save the cache.
|
||||
|
||||
```
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
.
|
||||
|
|
Loading…
Reference in a new issue