Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: configure restore-keys for caches #1806

Merged

Conversation

the-mikedavis
Copy link
Member

restore-keys is a configuration option for the actions/cache action
which specifies fallback behavior. The docs say it best:

When a cache miss occurs, the action searches for alternate keys
called restore-keys.

If you provide restore-keys, the cache action sequentially
searches for any caches that match the list of restore-keys.
... If there are no exact matches, the action searches for partial
matches of the restore keys. When the action finds a partial match,
the most recent cache is restored to the path directory.

So this improves caching when there's a miss. For example if I edit
.github/workflows/languages.toml, the current behavior is that the
cache for downloaded grammars will miss and all of them will need to
be fetched again. With restore-keys, we use the latest published
cache as 'good enough', we'll fetch whatever grammars changed, and
then at the end we publish a new cache under the new hash.

`restore-keys` is a configuration option for the actions/cache action
which specifies fallback behavior. The [docs][docs] say it best:

> When a cache miss occurs, the action searches for alternate keys
> called `restore-keys`.
>
> If you provide `restore-keys`, the `cache` action sequentially
> searches for any caches that match the list of `restore-keys`.
> ... If there are no exact matches, the action searches for partial
> matches of the restore keys. When the action finds a partial match,
> the most recent cache is restored to the `path` directory.

So this improves caching when there's a miss. For example if I edit
`.github/workflows/languages.toml`, the current behavior is that the
cache for downloaded grammars will miss and all of them will need to
be fetched again. With `restore-keys`, we use the latest published
cache as 'good enough', we'll fetch whatever grammars changed, and
then at the end we publish a new cache under the new hash.

[docs]: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action
@archseer archseer merged commit 43fc073 into helix-editor:master Mar 14, 2022
@the-mikedavis the-mikedavis deleted the md-actions-cache-fallback-keys branch March 14, 2022 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants