mirror of
https://git.bjxgj.com/xgj/xgj-actions.git
synced 2025-10-14 17:33:37 +08:00
fix: 移除冗余的项目级别store-dir配置,改用环境变量提示
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
| 参数名 | 描述 | 必需 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| `cache-prefix` | 缓存 key 前缀 | 否 | `modules` |
|
||||
| `store-path` | 自定义 pnpm store 路径(默认使用 runner 临时目录) | 否 | `''` |
|
||||
| `force-install` | 是否强制安装(追加 `--force`) | 否 | `false` |
|
||||
| `install-command` | 自定义安装命令,覆盖默认的 `pnpm install` | 否 | `''` |
|
||||
| `install-args` | 附加参数(仅默认命令时生效) | 否 | `''` |
|
||||
@@ -41,18 +40,17 @@
|
||||
|
||||
- 默认缓存 pnpm store,命中后执行 `pnpm install --offline --frozen-lockfile`,通常在 10 秒内完成链接。
|
||||
- 首次执行或 lock 文件变更时执行 `pnpm install --prefer-offline --frozen-lockfile`,完成后写入缓存。
|
||||
- 当未显式提供 `cache-hash` 时,会依次使用 `pnpm-lock.yaml`、`package.json` 计算 hash 作为兜底,确保缓存具备基本失效条件。
|
||||
|
||||
## 🔁 缓存路径
|
||||
|
||||
默认缓存路径为 `${{ runner.temp }}/.pnpm-store`。如需与团队现有目录保持一致,可通过 `store-path` 自定义:
|
||||
Action 会根据以下优先级自动识别 pnpm store:
|
||||
|
||||
```yaml
|
||||
with:
|
||||
store-path: ~/.cache/pnpm-store
|
||||
cache-hash: ${{ hashFiles('pnpm-lock.yaml') }}
|
||||
```
|
||||
- 显式的 `PNPM_STORE_DIR` 或 `npm_config_store_dir` 环境变量
|
||||
- 项目/全局 `.npmrc` 中的 `store-dir=` 配置(支持相对路径自动展开)
|
||||
- 若以上均不存在,退回 `${{ runner.temp }}/.pnpm-store`
|
||||
|
||||
> 提示:如自定义路径,需确保同一 Runner 不会被多个并发作业共享该目录,以免产生竞争条件。
|
||||
解析完成后会打印 `pnpm store path: ...`,并将路径写入环境变量 `PNPM_STORE_DIR` 供后续步骤使用。
|
||||
|
||||
## ⚙️ 进阶配置
|
||||
|
||||
|
Reference in New Issue
Block a user