ci: restore pnpm store cache with corepack · openclaw/openclaw@84e4bff
steipete
·
2026-05-26
·
via Recent Commits to openclaw:main
File tree
.github/actions/setup-pnpm-store-cache
| Original file line number | Diff line number | Diff line change |
|---|
@@ -53,7 +53,7 @@ runs:
|
53 | 53 | PACKAGE_MANAGER_FILE: ${{ inputs.package-manager-file }} |
54 | 54 | run: | |
55 | 55 | set -euo pipefail |
56 | | - package_manager="$(node -e "const pkg = require(process.argv[1]); process.stdout.write(pkg.packageManager || '')" "$PACKAGE_MANAGER_FILE")" |
| 56 | + package_manager="$(node -e "const fs = require('node:fs'); const path = require('node:path'); const pkg = JSON.parse(fs.readFileSync(path.resolve(process.argv[1]), 'utf8')); process.stdout.write(pkg.packageManager || '')" "$PACKAGE_MANAGER_FILE")" |
57 | 57 | case "$package_manager" in |
58 | 58 | pnpm@*) ;; |
59 | 59 | *) |
@@ -64,13 +64,25 @@ runs:
|
64 | 64 | corepack enable |
65 | 65 | corepack prepare "$package_manager" --activate |
66 | 66 | |
67 | | - - name: Ensure pnpm store cache directory exists |
| 67 | + - name: Resolve pnpm store path |
| 68 | +id: pnpm-store |
68 | 69 | if: ${{ inputs.use-actions-cache == 'true' && runner.os != 'Windows' }} |
69 | 70 | shell: bash |
70 | 71 | run: | |
71 | 72 | set -euo pipefail |
72 | 73 | store_path="$(pnpm store path --silent)" |
73 | 74 | node -e "require('node:fs').mkdirSync(process.argv[1], { recursive: true })" "$store_path" |
| 75 | + echo "path=$store_path" >> "$GITHUB_OUTPUT" |
| 76 | + |
| 77 | + - name: Restore pnpm store cache |
| 78 | +if: ${{ inputs.use-actions-cache == 'true' && runner.os != 'Windows' }} |
| 79 | +uses: actions/cache@v5 |
| 80 | +with: |
| 81 | +path: ${{ steps.pnpm-store.outputs.path }} |
| 82 | +key: pnpm-store-${{ runner.os }}-${{ inputs.node-version }}-${{ hashFiles(inputs.lockfile-path) }} |
| 83 | +restore-keys: | |
| 84 | + pnpm-store-${{ runner.os }}-${{ inputs.node-version }}- |
| 85 | + pnpm-store-${{ runner.os }}- |
74 | 86 | |
75 | 87 | - name: Record pnpm version |
76 | 88 | id: pnpm-version |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。