From e99f780f900349e5fdc12e08d9810bd8c208e28c Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 22 Jul 2026 14:17:14 -0700 Subject: [PATCH 1/2] fix(ci): save the Next.js build cache every run instead of freezing it at the lockfile key The cache key was only runner.os + bun.lock hash, and GitHub caches are immutable per key: the first run after a lockfile change saved the cache once, then every later run hit the primary key and skipped the save ('Cache hit occurred on the primary key ... not saving cache'), so builds compiled against a cache stale since the last lockfile bump. Suffix the key with the commit SHA so each run saves its refreshed cache, and restore via prefix match to the most recent entry. --- .github/workflows/test-build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index ed348a41446..41894ae47cb 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -236,12 +236,19 @@ jobs: key: ${{ github.repository }}-turbo-cache-build-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }} path: ./.turbo + # Keyed per commit so EVERY run saves its refreshed cache — a key without + # a unique suffix is written once and then frozen (GitHub caches are + # immutable per key; a primary-key hit skips the save), which left builds + # compiling against a cache stale since the last lockfile change. The + # restore-keys prefix match picks the most recently saved cache for this + # lockfile, falling back across lockfile changes. - name: Restore Next.js build cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: ./apps/sim/.next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }} + key: ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}-${{ github.sha }} restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}- ${{ runner.os }}-nextjs- - name: Install dependencies From a860339007ac16d45729ee2738e227b6154b5b8a Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 22 Jul 2026 14:23:46 -0700 Subject: [PATCH 2/2] fix(ci): make the Next.js cache key unique per run attempt so reruns can save too --- .github/workflows/test-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 41894ae47cb..285c7ec53f6 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -246,8 +246,9 @@ jobs: uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: ./apps/sim/.next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}-${{ github.sha }} + key: ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}-${{ github.sha }}- ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}- ${{ runner.os }}-nextjs-