From b26427e53eeeb8730a03e344c65c6600352c13c2 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Mon, 15 Feb 2021 14:36:25 -0700 Subject: [PATCH 1/2] Adds documentation hints for caching. Fixes #8. --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index 1ae9812..9b445b2 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,40 @@ jobs: - args: [--global, gulp, prettier, typescript] ``` +### Cache + +To speed up install times + +```yaml +on: + - push + - pull_request + +jobs: + runs-on: ubuntu-latest + + steps: + build: + - uses: actions/checkout@v2 + + - name: Cache pnpm modules + uses: actions/cache@v2 + env: + cache-name: cache-pnpm-modules + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}- + + - uses: pnpm/action-setup@v1.2.1 + with: + version: 5.17.2 + run_install: true +``` + +You don't need to run `pnpm store prune` at the end; this package will take care of that for you. + ## Notes This action does not setup Node.js for you, use [actions/setup-node](https://github.com/actions/setup-node) yourself. From 6c1466d327e6f4c2ae3d5e0b192bdbe474621620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=E1=BA=A3i?= Date: Thu, 18 Feb 2021 08:30:07 +0700 Subject: [PATCH 2/2] Make some tweaks to example code snippets --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9b445b2..7e4e7c5 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ jobs: steps: - uses: pnpm/action-setup@v1.2.1 with: - version: 4.11.1 + version: 5.17.2 ``` ### Install PNPM and a few NPM packages @@ -85,16 +85,14 @@ jobs: - uses: pnpm/action-setup@v1.2.1 with: - version: 4.11.1 + version: 5.17.2 run_install: | - recursive: true args: [--frozen-lockfile, --strict-peer-dependencies] - args: [--global, gulp, prettier, typescript] ``` -### Cache - -To speed up install times +### Use cache to reduce installation time ```yaml on: @@ -124,7 +122,7 @@ jobs: run_install: true ``` -You don't need to run `pnpm store prune` at the end; this package will take care of that for you. +**Note:** You don't need to run `pnpm store prune` at the end; post-action has already taken care of that. ## Notes