Skip to content

Commit ed61ee5

Browse files
committed
fix(ci): polish cache step — use GITHUB_OUTPUT, fix hashFiles glob, expand ABI comment
- Switch STORE_PATH from $GITHUB_ENV to $GITHUB_OUTPUT (step-scoped, per GitHub Actions security hardening guide) - Narrow hashFiles glob from '**/pnpm-lock.yaml' to 'pnpm-lock.yaml' (root-only, avoids spurious cache busts from docs/examples lockfiles) - Reword comment to show ABI mismatch is symmetric across all versions - Document that actions/cache is equally fork-safe (GitHub platform guarantee)
1 parent 2140e64 commit ed61ee5

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/test_unit.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,23 @@ jobs:
6666
with:
6767
node-version: ${{ matrix.node-version }}
6868
# Do NOT use cache: "pnpm" here — its key omits the Node.js version,
69-
# so an ABI-137 better-sqlite3 binary cached from a Node 24 job would
70-
# be served to Node 20/22 jobs, causing "Module did not self-register".
71-
# We handle pnpm caching manually below with the node-version in the key.
69+
# so a better-sqlite3 binary compiled for one Node ABI (e.g. ABI 137
70+
# from Node 24) would be served to a job running a different ABI
71+
# (Node 20 = ABI 115, Node 22 = ABI 127), causing "Module did not
72+
# self-register". We handle pnpm caching manually below with the
73+
# node-version in the key.
74+
# Fork-safety note: actions/cache is equally fork-safe — GitHub
75+
# enforces read-only cache access for fork PRs at the platform level.
7276

7377
- name: Get pnpm store directory
74-
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
78+
id: pnpm-cache
79+
run: echo "store-path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
7580

7681
- name: Cache pnpm store (scoped to Node.js version)
7782
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
7883
with:
79-
path: ${{ env.STORE_PATH }}
80-
key: ${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
84+
path: ${{ steps.pnpm-cache.outputs.store-path }}
85+
key: ${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-${{ hashFiles('pnpm-lock.yaml') }}
8186
restore-keys: |
8287
${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-
8388

0 commit comments

Comments
 (0)