Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf5d99b

Browse files
committed
Initial @actions/cache stub implementation
1 parent a618217 commit cf5d99b

File tree

15 files changed

+1508
-54
lines changed

15 files changed

+1508
-54
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## v6
4+
5+
Adds support for the `@actions/cache` package, allowing for local caching of
6+
dependencies and other files between runs of a GitHub Action. This is achieved
7+
by setting the `LOCAL_ACTION_CACHE_PATH` environment variable to a directory
8+
where cache files will be stored.
9+
10+
For both `@actions/artifact` and `@actions/cache`, the `LOCAL_ACTION_WORKSPACE`
11+
environment variable must be set. Otherwise, calling functions will throw an
12+
error. Similarly, `@actions/artifact` requires the `LOCAL_ACTION_ARTIFACT_PATH`
13+
environment variable to be set, and `@actions/cache` requires the
14+
`LOCAL_ACTION_CACHE_PATH` environment variable to be set.
15+
316
## v5
417

518
Removes support for custom `paths` in the target action's `tsconfig.json`. This

docs/supported-functionality.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,34 @@ to the `local-action` command.
3737
> workflow runs (e.g. if you try to download an artifact from a different
3838
> repository), these requests **will be passed to the GitHub API**.
3939
40+
## [`@actions/cache`](https://github.com/actions/toolkit/tree/main/packages/cache)
41+
42+
The stubbed version of `@actions/cache` functions similarly to the real package.
43+
However, any caches that are created as part of a `local-action` run will be
44+
stored on your local workstation. The specific path must be set using the
45+
`LOCAL_ACTION_CACHE_PATH` environment variable in the `.env` file passed to the
46+
`local-action` command.
47+
48+
- Since this is a local cache, the GitHub Actions cache limits (e.g. size,
49+
retention) do not apply. However, the stubbed version does enforce that the
50+
`key` and `restoreKeys` parameters are unique per call to `saveCache()`.
51+
- The current implementation of the `@actions/cache` package checks whether to
52+
use `v1` or `v2` of the caching service. This is ignored in the local
53+
implementation.
54+
- Additionally, since no actual caches are downloaded/uploaded, concepts like
55+
chunking, concurrency, and timeouts no longer apply. Because of this, most
56+
properties in the `options` parameter of `restoreCache()` and `saveCache()`
57+
are ignored.
58+
- Any upload/download progress tracking is ignored. E.g. the `DownloadProgress`
59+
and `UploadProgress` classes are not implemented.
60+
61+
| Feature | Supported | Notes |
62+
| ------------------ | ------------------ | ------------------------------------------ |
63+
| `restoreCache()` | :white_check_mark: | Only the `lookupOnly` option is respected. |
64+
| `saveCache()` | :white_check_mark: | All options are ignored |
65+
| `DownloadProgress` | :x: | |
66+
| `UploadProgress` | :x: | |
67+
4068
## [`@actions/core`](https://github.com/actions/toolkit/blob/main/packages/core/README.md)
4169

4270
| Feature | Supported | Notes |
@@ -82,9 +110,6 @@ be `undefined`. For more information, see
82110
The following packages are under investigation for how to integrate with
83111
`local-action`. Make sure to check back later!
84112

85-
- [`@actions/attest`](https://github.com/actions/toolkit/tree/main/packages/attest)
86-
- [`@actions/cache`](https://github.com/actions/toolkit/tree/main/packages/cache)
87-
88113
## No Action Needed
89114

90115
Currently, there shouldn't be any need to stub the functionality of the
@@ -93,6 +118,7 @@ expected when run using `local-action`. If you do encounter a scenario where
93118
this doesn't work correctly, please
94119
[open an issue!](https://github.com/github/local-action/issues/new)
95120

121+
- [`@actions/attest`](https://github.com/actions/toolkit/tree/main/packages/attest)
96122
- [`@actions/exec`](https://github.com/actions/toolkit/tree/main/packages/exec)
97123
- [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob)
98124
- [`@actions/http-client`](https://github.com/actions/toolkit/tree/main/packages/http-client)

0 commit comments

Comments
 (0)