Skip to content

Commit 56ade92

Browse files
refactor(root): extract nx cache key pattern to workflow environment variable
- Add NX_CACHE_FILES environment variable to reduce duplication - Update all three cache key patterns to use env.NX_CACHE_FILES - Improves maintainability and reduces copy-paste errors - Addresses Copilot feedback on cache key pattern duplication TICKET: WP-6096
1 parent d049b8c commit 56ade92

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ permissions:
1616

1717
env:
1818
NX_NO_CLOUD: true
19+
NX_CACHE_FILES: "modules/*/src/**/*.ts,modules/*/src/**/*.js,modules/*/*.json"
1920

2021
jobs:
2122
unit-test:
@@ -74,7 +75,7 @@ jobs:
7475
path: |
7576
.nx/cache
7677
modules/*/dist
77-
key: ${{ runner.os }}-nx-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('modules/*/src/**/*.ts', 'modules/*/src/**/*.js', 'modules/*/*.json') }}
78+
key: ${{ runner.os }}-nx-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles(env.NX_CACHE_FILES) }}
7879
restore-keys: |
7980
${{ runner.os }}-nx-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }}-
8081
${{ runner.os }}-nx-${{ matrix.node-version }}-
@@ -184,7 +185,7 @@ jobs:
184185
path: |
185186
.nx/cache
186187
modules/*/dist
187-
key: ${{ runner.os }}-nx-license-${{ hashFiles('yarn.lock') }}-${{ hashFiles('modules/*/src/**/*.ts', 'modules/*/src/**/*.js', 'modules/*/*.json') }}
188+
key: ${{ runner.os }}-nx-license-${{ hashFiles('yarn.lock') }}-${{ hashFiles(env.NX_CACHE_FILES) }}
188189
restore-keys: |
189190
${{ runner.os }}-nx-license-${{ hashFiles('yarn.lock') }}-
190191
${{ runner.os }}-nx-license-
@@ -291,7 +292,7 @@ jobs:
291292
path: |
292293
.nx/cache
293294
modules/*/dist
294-
key: ${{ runner.os }}-nx-browser-${{ hashFiles('yarn.lock') }}-${{ hashFiles('modules/*/src/**/*.ts', 'modules/*/src/**/*.js', 'modules/*/*.json') }}
295+
key: ${{ runner.os }}-nx-browser-${{ hashFiles('yarn.lock') }}-${{ hashFiles(env.NX_CACHE_FILES) }}
295296
restore-keys: |
296297
${{ runner.os }}-nx-browser-${{ hashFiles('yarn.lock') }}-
297298
${{ runner.os }}-nx-browser-

0 commit comments

Comments
 (0)