You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The action has a built-in functionality for caching and restoring npm/yarn dependencies. Supported package managers are `npm`, `yarn`, `pnpm`. The `cache` input is optional, and caching is turned off by default.
44
+
The action has a built-in functionality for caching and restoring npm/yarn dependencies. Supported package managers are `npm`, `yarn`, `pnpm`. The `cache` input is optional, and caching is turned off by default. By default, the action searches for the dependency file in the project root and uses its hash as a part of cache key. Use `cache-dependency-path` to specify custom dependency file path. The field accepts wildcards or an array of files to be cached.
45
45
46
46
**Caching npm dependencies:**
47
47
```yaml
@@ -90,7 +90,7 @@ steps:
90
90
- run: pnpm test
91
91
```
92
92
93
-
> At the moment, only `lock` files in the project root are supported.
93
+
For more examlpes of caching, please see the [Advanced usage](docs/advanced-usage.md#caching-packages-dependencies) guide.
Copy file name to clipboardExpand all lines: docs/advanced-usage.md
+36-6Lines changed: 36 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Advanced usage
2
2
3
-
### Check latest version:
3
+
### Check latest version
4
4
5
5
The `check-latest` flag defaults to `false`. When set to `false`, the action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/). Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific version of Node.js is always used.
6
6
@@ -19,7 +19,7 @@ steps:
19
19
- run: npm test
20
20
```
21
21
22
-
### Architecture:
22
+
### Architecture
23
23
24
24
You can use any of the [supported operating systems](https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners), and the compatible `architecture` can be selected using `architecture`. Values are `x86`, `x64`, `arm64`, `armv6l`, `armv7l`, `ppc64le`, `s390x` (not all of the architectures are available on all platforms).
25
25
@@ -39,7 +39,37 @@ jobs:
39
39
- run: npm test
40
40
```
41
41
42
-
### Multiple Operating Systems and Architectures:
42
+
### Caching packages dependencies
43
+
44
+
**Using wildcard patterns to cache dependencies**
45
+
```yaml
46
+
steps:
47
+
- uses: actions/checkout@v2
48
+
- uses: actions/setup-node@v2
49
+
with:
50
+
node-version: '14'
51
+
cache: 'npm'
52
+
cache-dependency-path: '**/package-lock.json'
53
+
- run: npm install
54
+
- run: npm test
55
+
```
56
+
57
+
**Using a list of file paths to cache dependencies**
0 commit comments