Skip to content

Pass additional restore-keys to cache action #366

@gustavovnicius

Description

@gustavovnicius

As can be seen in their examples: https://github.com/actions/cache/blob/main/examples.md#java---gradle

It is recommended that additional restore-keys are passed when using actions/cache. https://github.com/actions/cache#inputs

https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key

const matchedKey = await cache.restoreCache(packageManager.path, primaryKey);
could be changed to something like:

const restoreKey = `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${packageManager.id}`;
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey, [restoreKey]); 

Metadata

Metadata

Assignees

Labels

feature requestNew feature or request to improve the current logic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions