Skip to content

Commit 406463a

Browse files
committed
optimize cache logic
1 parent 680154b commit 406463a

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

.github/workflows/lint-404s.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,36 @@ jobs:
3232
bun-version: latest
3333

3434
- uses: actions/cache@v4
35-
id: cache
35+
id: cache-node-modules
3636
with:
3737
path: |
3838
${{ github.workspace }}/node_modules
39-
${{ github.workspace }}/.next/cache
4039
${{ github.workspace }}/.eslintcache
41-
key: node-${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
40+
key: node-modules-${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
4241
restore-keys: |
43-
node-${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-
42+
node-modules-${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-
43+
44+
# Cache the Next.js build output to avoid rebuilding when docs content changes
45+
- uses: actions/cache@v4
46+
id: cache-nextjs
47+
with:
48+
path: |
49+
${{ github.workspace }}/.next
50+
key: nextjs-build-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('src/**', 'app/**', 'next.config.ts', 'tsconfig.json', 'tailwind.config.mjs') }}
51+
restore-keys: |
52+
nextjs-build-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
53+
nextjs-build-${{ runner.os }}-
4454
4555
- run: yarn install --frozen-lockfile
4656

4757
- run: yarn next build
48-
if: steps.filter.outputs.docs == 'true'
58+
if: steps.filter.outputs.docs == 'true' && steps.cache-nextjs.outputs.cache-hit != 'true'
4959
env:
5060
SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0
5161
NEXT_PUBLIC_SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0
5262

5363
- run: yarn build:developer-docs
54-
if: steps.filter.outputs.dev-docs == 'true'
64+
if: steps.filter.outputs.dev-docs == 'true' && steps.cache-nextjs.outputs.cache-hit != 'true'
5565
env:
5666
SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0
5767
NEXT_PUBLIC_SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0

0 commit comments

Comments
 (0)