Skip to content

Commit 8704099

Browse files
Add documentation for actions/setup-node pnpm cache (#8389)
1 parent 8676c51 commit 8704099

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

content/actions/guides/building-and-testing-nodejs.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,27 @@ steps:
265265
- run: yarn test
266266
```
267267

268-
To cache dependencies, you must have a `package-lock.json` or `yarn.lock` file in the root of the repository. If you need more flexible customization, you can use the [`cache` action](https://github.com/marketplace/actions/cache). For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>".
268+
The following example caches dependencies for pnpm (v6.10+).
269+
270+
```yaml{:copy}
271+
{% data reusables.actions.actions-not-certified-by-github-comment %}
272+
273+
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
274+
275+
steps:
276+
- uses: actions/checkout@v2
277+
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
278+
with:
279+
version: 6.10.0
280+
- uses: actions/setup-node@v2
281+
with:
282+
node-version: '14'
283+
cache: 'pnpm'
284+
- run: pnpm install
285+
- run: pnpm test
286+
```
287+
288+
To cache dependencies, you must have a `package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml` file in the root of the repository. If you need more flexible customization, you can use the [`cache` action](https://github.com/marketplace/actions/cache). For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>".
269289

270290
## Building and testing your code
271291

content/actions/guides/caching-dependencies-to-speed-up-workflows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To cache dependencies for a job, you'll need to use {% data variables.product.pr
2626

2727
If you are caching Ruby gems, instead consider using the Ruby maintained action, which can cache bundle installs on initiation. For more information, see [`ruby/setup-ruby`](https://github.com/ruby/setup-ruby#caching-bundle-install-automatically).
2828

29-
To cache and restore dependencies for npm or Yarn, you can use the [`actions/setup-node` action](https://github.com/actions/setup-node).
29+
To cache and restore dependencies for npm, Yarn, or pnpm, you can use the [`actions/setup-node` action](https://github.com/actions/setup-node).
3030

3131
{% warning %}
3232

0 commit comments

Comments
 (0)