-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add info about split up cache steps (#190)
- Loading branch information
Showing
1 changed file
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,12 +130,33 @@ In order to mitigate issues regarding rate limiting or to reduce stress on exter | |
args: "--cache --max-cache-age 1d" | ||
``` | ||
|
||
Note that there is no need for another step at the end to store the cache. | ||
There will automatically be a `Post` step (generated from the used `actions/cache` action) taking care of that. | ||
It will compare and save the cache based on the given key. | ||
So in this setup, as long as a user triggers the CI run from the same commit, it will be the same key. The first run will save the cache, subsequent runs will not update it (because it's the same commit hash). | ||
For restoring the cache, the most recent available one is used (commit hash doesn't matter). | ||
|
||
If you need more control over when caches are restored and saved, you can split the cache step and e.g. ensure to always save the cache (also when the link check step fails): | ||
```yml | ||
- name: Restore lychee cache | ||
id: restore-cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: .lycheecache | ||
key: cache-lychee-${{ github.sha }} | ||
restore-keys: cache-lychee- | ||
- name: Run lychee | ||
uses: lycheeverse/[email protected] | ||
with: | ||
args: "--cache --max-cache-age 1d" | ||
- name: Save lychee cache | ||
uses: actions/cache/save@v3 | ||
if: always() | ||
with: | ||
path: .lycheecache | ||
key: ${{ steps.restore-cache.outputs.cache-primary-key }} | ||
``` | ||
|
||
## Excluding links from getting checked | ||
|
||
Add a `.lycheeignore` file to the root of your repository to exclude links from | ||
|