diff --git a/.licenses/npm/@octokit/action.dep.yml b/.licenses/npm/@octokit/action.dep.yml new file mode 100644 index 0000000..ebd1c35 Binary files /dev/null and b/.licenses/npm/@octokit/action.dep.yml differ diff --git a/.licenses/npm/@octokit/auth-action.dep.yml b/.licenses/npm/@octokit/auth-action.dep.yml new file mode 100644 index 0000000..58d1045 Binary files /dev/null and b/.licenses/npm/@octokit/auth-action.dep.yml differ diff --git a/.licenses/npm/@octokit/auth-token.dep.yml b/.licenses/npm/@octokit/auth-token.dep.yml new file mode 100644 index 0000000..1c4be09 Binary files /dev/null and b/.licenses/npm/@octokit/auth-token.dep.yml differ diff --git a/.licenses/npm/@octokit/core.dep.yml b/.licenses/npm/@octokit/core.dep.yml new file mode 100644 index 0000000..b16f65b Binary files /dev/null and b/.licenses/npm/@octokit/core.dep.yml differ diff --git a/.licenses/npm/@octokit/endpoint.dep.yml b/.licenses/npm/@octokit/endpoint.dep.yml new file mode 100644 index 0000000..1e90005 Binary files /dev/null and b/.licenses/npm/@octokit/endpoint.dep.yml differ diff --git a/.licenses/npm/@octokit/graphql.dep.yml b/.licenses/npm/@octokit/graphql.dep.yml new file mode 100644 index 0000000..b7bc411 Binary files /dev/null and b/.licenses/npm/@octokit/graphql.dep.yml differ diff --git a/.licenses/npm/@octokit/openapi-types.dep.yml b/.licenses/npm/@octokit/openapi-types.dep.yml new file mode 100644 index 0000000..44d4bbd Binary files /dev/null and b/.licenses/npm/@octokit/openapi-types.dep.yml differ diff --git a/.licenses/npm/@octokit/plugin-paginate-rest.dep.yml b/.licenses/npm/@octokit/plugin-paginate-rest.dep.yml new file mode 100644 index 0000000..784d283 Binary files /dev/null and b/.licenses/npm/@octokit/plugin-paginate-rest.dep.yml differ diff --git a/.licenses/npm/@octokit/plugin-rest-endpoint-methods.dep.yml b/.licenses/npm/@octokit/plugin-rest-endpoint-methods.dep.yml new file mode 100644 index 0000000..b01f3f1 Binary files /dev/null and b/.licenses/npm/@octokit/plugin-rest-endpoint-methods.dep.yml differ diff --git a/.licenses/npm/@octokit/request-error.dep.yml b/.licenses/npm/@octokit/request-error.dep.yml new file mode 100644 index 0000000..ec4a9f8 Binary files /dev/null and b/.licenses/npm/@octokit/request-error.dep.yml differ diff --git a/.licenses/npm/@octokit/request.dep.yml b/.licenses/npm/@octokit/request.dep.yml new file mode 100644 index 0000000..b0baba3 Binary files /dev/null and b/.licenses/npm/@octokit/request.dep.yml differ diff --git a/.licenses/npm/@octokit/types.dep.yml b/.licenses/npm/@octokit/types.dep.yml new file mode 100644 index 0000000..949433a Binary files /dev/null and b/.licenses/npm/@octokit/types.dep.yml differ diff --git a/.licenses/npm/@types/node.dep.yml b/.licenses/npm/@types/node.dep.yml index 65dc483..77f9f75 100644 Binary files a/.licenses/npm/@types/node.dep.yml and b/.licenses/npm/@types/node.dep.yml differ diff --git a/.licenses/npm/agent-base.dep.yml b/.licenses/npm/agent-base.dep.yml new file mode 100644 index 0000000..d02af9d Binary files /dev/null and b/.licenses/npm/agent-base.dep.yml differ diff --git a/.licenses/npm/before-after-hook.dep.yml b/.licenses/npm/before-after-hook.dep.yml new file mode 100644 index 0000000..c147501 Binary files /dev/null and b/.licenses/npm/before-after-hook.dep.yml differ diff --git a/.licenses/npm/debug.dep.yml b/.licenses/npm/debug.dep.yml new file mode 100644 index 0000000..675446f Binary files /dev/null and b/.licenses/npm/debug.dep.yml differ diff --git a/.licenses/npm/deprecation.dep.yml b/.licenses/npm/deprecation.dep.yml new file mode 100644 index 0000000..683fdfc Binary files /dev/null and b/.licenses/npm/deprecation.dep.yml differ diff --git a/.licenses/npm/https-proxy-agent.dep.yml b/.licenses/npm/https-proxy-agent.dep.yml new file mode 100644 index 0000000..58169bf Binary files /dev/null and b/.licenses/npm/https-proxy-agent.dep.yml differ diff --git a/.licenses/npm/is-plain-object.dep.yml b/.licenses/npm/is-plain-object.dep.yml new file mode 100644 index 0000000..671ba20 Binary files /dev/null and b/.licenses/npm/is-plain-object.dep.yml differ diff --git a/.licenses/npm/ms.dep.yml b/.licenses/npm/ms.dep.yml new file mode 100644 index 0000000..293e374 Binary files /dev/null and b/.licenses/npm/ms.dep.yml differ diff --git a/.licenses/npm/once.dep.yml b/.licenses/npm/once.dep.yml new file mode 100644 index 0000000..7b0dfcf Binary files /dev/null and b/.licenses/npm/once.dep.yml differ diff --git a/.licenses/npm/universal-user-agent.dep.yml b/.licenses/npm/universal-user-agent.dep.yml new file mode 100644 index 0000000..9cf02a9 Binary files /dev/null and b/.licenses/npm/universal-user-agent.dep.yml differ diff --git a/.licenses/npm/wrappy.dep.yml b/.licenses/npm/wrappy.dep.yml new file mode 100644 index 0000000..2a532ec Binary files /dev/null and b/.licenses/npm/wrappy.dep.yml differ diff --git a/README.md b/README.md index 7f27d6c..b92a08e 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac ### v3 +* Added a workaround to allow updating/refreshing existing caches, via the `refresh-cache` option and requiring a valid Github API token. * Added support for caching in GHES 3.5+. * Fixed download issue for files > 2GB during restore. * Updated the minimum runner version support from node 12 -> node 16. @@ -53,10 +54,12 @@ If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are requir * `enableCrossOsArchive` - An optional boolean when enabled, allows Windows runners to save or restore caches that can be restored or saved respectively on other platforms. Default: `false` * `fail-on-cache-miss` - Fail the workflow if cache entry is not found. Default: `false` * `lookup-only` - If true, only checks if cache entry exists and skips download. Does not change save cache behavior. Default: `false` +* `refresh-cache` - An optional boolean, when enabled it will result in a matched key being deleted after being restored, allowing it to be reused with refreshed/updated content. Default: false #### Environment Variables * `SEGMENT_DOWNLOAD_TIMEOUT_MINS` - Segment download timeout (in minutes, default `10`) to abort download of the segment if not completed in the defined number of minutes. [Read more](https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout) +* `GITHUB_TOKEN` - A Github API token, required for authenticating to the API when the `refresh-cache` option is enabled. ### Outputs diff --git a/action.yml b/action.yml index b6cfc82..9a16c30 100644 --- a/action.yml +++ b/action.yml @@ -27,7 +27,7 @@ inputs: default: 'false' required: false refresh-cache: - description: 'Whether to try and refresh existing caches (requires GITHUB_TOKEN to be present in env)' + description: 'An optional boolean, when enabled it will result in a matched key being deleted after being restored, allowing it to be reused with refreshed/updated content. Default: false' required: false default: 'false' outputs: diff --git a/save/README.md b/save/README.md index 8ce56d2..3760b89 100644 --- a/save/README.md +++ b/save/README.md @@ -9,6 +9,11 @@ The save action saves a cache. It works similarly to the `cache` action except t * `key` - An explicit key for a cache entry. See [creating a cache key](../README.md#creating-a-cache-key). * `path` - A list of files, directories, and wildcard patterns to cache. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns. * `upload-chunk-size` - The chunk size used to split up large files during upload, in bytes +* `refresh-cache` - An optional boolean, when enabled it will result in a matched key being deleted after being restored, allowing it to be reused with refreshed/updated content. Default: false + +#### Environment Variables + +* `GITHUB_TOKEN` - A Github API token, required for authenticating to the API when the `refresh-cache` option is enabled. ### Outputs diff --git a/tips-and-workarounds.md b/tips-and-workarounds.md index 125fa5f..d22a4a3 100644 --- a/tips-and-workarounds.md +++ b/tips-and-workarounds.md @@ -21,7 +21,8 @@ A cache today is immutable and cannot be updated. But some use cases require the ``` Please note that this will create a new cache on every run and hence will consume the cache [quota](./README.md#cache-limits). - +* As a way to get around this limitation, the `refresh-cache` option exists. The way this works is, after matching a key and restoring a cache, it makes a request directly to the Github API and deletes the contents of that cache entry, then leaving said key free to be updated. + ## Use cache across feature branches Reusing cache across feature branches is not allowed today to provide cache [isolation](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache). However if both feature branches are from the default branch, a good way to achieve this is to ensure that the default branch has a cache. This cache will then be consumable by both feature branches.