From 960844ea66d28b0cf0e3e5f37c78665c6cf44289 Mon Sep 17 00:00:00 2001 From: Aaron Silverman Date: Mon, 25 May 2026 21:28:44 -0400 Subject: [PATCH] Include Node version in CI setup cache key [FFESUPPORT-731] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The composite setup action caches `**/node_modules` keyed on OS + `yarn.lock` hash only. If a `node_modules` cache built under a different Node version were restored, packages with native bindings could load mismatched ABI binaries — and because the cache-hit path skips the install step, deps wouldn't get rebuilt. Capture the resolved Node version (`node -v`) into a step output, then include it in both the primary cache key and the `restore-keys` prefix. That way, bumping Node automatically busts the cache instead of relying on lockfile churn to do it incidentally. Stays with `actions/setup-node@v3` and `actions/cache@v3` — this is the minimal-change variant. Caching Yarn's download cache instead of `node_modules` would be the more robust pattern, but that's a bigger restructure for a separate ticket if we want it. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/actions/setup/action.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 60d3c3a..88a7af3 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -9,15 +9,20 @@ runs: with: node-version: '20.x' # Specify the Node.js version directly here + - name: Resolve installed Node version + id: node-info + run: echo "version=$(node -v)" >> "$GITHUB_OUTPUT" + shell: bash + - name: Cache dependencies id: yarn-cache uses: actions/cache@v3 with: path: | **/node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-${{ steps.node-info.outputs.version }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-yarn- + ${{ runner.os }}-node-${{ steps.node-info.outputs.version }}-yarn- - name: Install dependencies if: steps.yarn-cache.outputs.cache-hit != 'true'