1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-11-30 23:59:16 +01:00

nit: added language to code blocks

This commit is contained in:
Sankalp Kotewar 2022-12-15 09:05:17 +00:00 committed by GitHub
parent da311f75a6
commit 05c9b49ea4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View file

@ -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. 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: steps:
- uses: actions/checkout@v3 - 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 #### Step 1 - Build the parent module and save it
``` ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -72,7 +72,7 @@ steps:
``` ```
#### Step 2 - Restore the built artifact from cache using the same key and path #### Step 2 - Restore the built artifact from cache using the same key and path
``` ```yaml
steps: steps:
- uses: actions/checkout@v3 - 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. 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: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View file

@ -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. 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: steps:
- uses: actions/checkout@v3 - 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 Let's say we have a restore step that computes key at runtime
``` ```yaml
uses: actions/cache/restore@v3 uses: actions/cache/restore@v3
id: restore-cache id: restore-cache
with: with:
@ -51,14 +51,14 @@ with:
``` ```
Case 1: Where an user would want to reuse the key as it is Case 1: Where an user would want to reuse the key as it is
``` ```yaml
uses: actions/cache/save@v3 uses: actions/cache/save@v3
with: with:
key: steps.restore-cache.output.key key: steps.restore-cache.output.key
``` ```
Case 2: Where the user would want to re-evaluate the key Case 2: Where the user would want to re-evaluate the key
``` ```yaml
uses: actions/cache/save@v3 uses: actions/cache/save@v3
with: with:
key: npm-cache-${{hashfiles(package-lock.json)}} 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. 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: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
. .