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 dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings.
44
+
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional, and caching is turned off by default.
45
45
46
-
Supported package managers are `npm`, `yarn`, `pnpm`. The `cache` input is optional, and caching is turned off by default.
46
+
The action defaults to search for the dependency file (`package-lock.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories.
47
47
48
-
The action defaults to search for the dependency file (`package-lock.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories. See the examples of `cache-dependency-path` usage in the [Advanced usage](docs/advanced-usage.md#caching-packages-dependencies) guide.
49
-
50
-
The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
48
+
See the examples of using cache for `yarn` / `pnpm` and `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-dependencies) guide.
51
49
52
50
**Caching npm dependencies:**
53
51
```yaml
@@ -61,42 +59,20 @@ steps:
61
59
- run: npm test
62
60
```
63
61
64
-
**Caching yarn dependencies:**
62
+
**Caching npm dependencies in monorepos:**
65
63
```yaml
66
64
steps:
67
65
- uses: actions/checkout@v2
68
66
- uses: actions/setup-node@v2
69
67
with:
70
68
node-version: '14'
71
-
cache: 'yarn'
72
-
- run: yarn install
73
-
- run: yarn test
74
-
```
75
-
Yarn caching handles both yarn versions: 1 or 2.
76
-
77
-
**Caching pnpm (v6.10+) dependencies:**
78
-
```yaml
79
-
# This workflow uses actions that are not certified by GitHub.
80
-
# They are provided by a third-party and are governed by
81
-
# separate terms of service, privacy policy, and support
82
-
# documentation.
83
-
84
-
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
Copy file name to clipboardExpand all lines: action.yml
+1-1
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ inputs:
22
22
cache:
23
23
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm'
24
24
cache-dependency-path:
25
-
description: 'Used to specify path to a dependencies file: package-lock.json, yarn.lock, etc. Supports wildcards or an array of file names.'
25
+
description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.'
26
26
# TODO: add input to control forcing to pull from cloud or dist.
27
27
# escape valve for someone having issues or needing the absolute latest which isn't cached yet
28
28
# Deprecated option, do not use. Will not be supported after October 1, 2019
0 commit comments