Skip to content

Commit e94b270

Browse files
jrmajorKSXGitHub
andauthored
feat: store caching (#188)
* add pnpm store caching * style: format * no semicolons * no star imports * import order * style: no star imports --------- Co-authored-by: khai96_ <[email protected]>
1 parent ee7b871 commit e94b270

File tree

11 files changed

+742
-16
lines changed

11 files changed

+742
-16
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ If `run_install` is a YAML string representation of either an object or an array
4242

4343
**Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--ignore-scripts, --strict-peer-dependencies]`.
4444

45+
### `cache`
46+
47+
**Optional** (_type:_ `boolean`, _default:_ `false`) Whether to cache the pnpm store directory.
48+
49+
### `cache_dependency_path`
50+
51+
**Optional** (_type:_ `string|string[]`, _default:_ `pnpm-lock.yaml`) File path to the pnpm lockfile, which contents hash will be used as a cache key.
52+
4553
### `package_json_file`
4654

4755
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json`/[`package.yaml`](https://github.com/pnpm/pnpm/pull/1799) to read "packageManager" configuration.
@@ -142,13 +150,7 @@ jobs:
142150
name: Install pnpm
143151
with:
144152
version: 10
145-
run_install: false
146-
147-
- name: Install Node.js
148-
uses: actions/setup-node@v4
149-
with:
150-
node-version: 20
151-
cache: 'pnpm'
153+
cache: true
152154
153155
- name: Install dependencies
154156
run: pnpm install

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ inputs:
1515
description: If specified, run `pnpm install`
1616
required: false
1717
default: 'null'
18+
cache:
19+
description: Whether to cache the pnpm store directory
20+
required: false
21+
default: 'false'
22+
cache_dependency_path:
23+
description: File path to the pnpm lockfile, which contents hash will be used as a cache key
24+
required: false
25+
default: 'pnpm-lock.yaml'
1826
package_json_file:
1927
description: File path to the package.json to read "packageManager" configuration. This path must be relative to the repository root (GITHUB_WORKSPACE).
2028
required: false

dist/index.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"update-pnpm-dist": "pnpm install && cp ./node_modules/pnpm/dist/pnpm.cjs ./dist/pnpm.cjs && cp ./node_modules/pnpm/dist/worker.js ./dist/worker.js"
88
},
99
"dependencies": {
10+
"@actions/cache": "^4.1.0",
1011
"@actions/core": "^1.10.1",
12+
"@actions/exec": "^1.1.1",
13+
"@actions/glob": "^0.5.0",
1114
"@types/expand-tilde": "^2.0.2",
1215
"@types/node": "^20.11.5",
1316
"expand-tilde": "^2.0.2",

0 commit comments

Comments
 (0)