Skip to content

Commit a4c6552

Browse files
jonphippsclaude
andcommitted
feat(ci): add skip Nx cache option to workflows
Add workflow_dispatch input to force fresh builds without Nx cache: - deploy-dev.yml: Add skip_nx_cache boolean input - nx-optimized-ci.yml: Add skip_nx_cache boolean input - Both workflows now support --skip-nx-cache flag - Also supports NX_SKIP_NX_CACHE environment variable This provides multiple ways to troubleshoot CI cache issues: 1. Manual workflow dispatch with 'Skip Nx cache' checkbox 2. Force build all sites option (already existed) 3. Environment variable for debugging Fixes CI build failures caused by corrupted Nx Cloud cache. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 8c07783 commit a4c6552

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
required: false
1212
default: 'false'
1313
type: boolean
14+
skip_nx_cache:
15+
description: 'Skip Nx cache (force fresh builds)'
16+
required: false
17+
default: 'false'
18+
type: boolean
1419

1520
permissions:
1621
contents: read
@@ -127,17 +132,27 @@ jobs:
127132
if: steps.affected.outputs.has-affected == 'true'
128133
run: |
129134
FORCE_BUILD="${{ inputs.force_build_all }}"
135+
SKIP_CACHE="${{ inputs.skip_nx_cache }}"
136+
137+
# Add skip cache flag if requested
138+
CACHE_FLAG=""
139+
if [ "$SKIP_CACHE" = "true" ]; then
140+
echo "Skipping Nx cache for fresh builds"
141+
CACHE_FLAG="--skip-nx-cache"
142+
fi
143+
130144
if [ "$FORCE_BUILD" = "true" ]; then
131145
echo "Force building all projects"
132-
pnpm nx run-many --target=build --all --parallel=1 --configuration=development
146+
pnpm nx run-many --target=build --all --parallel=1 --configuration=development $CACHE_FLAG
133147
else
134148
echo "Building affected projects"
135-
pnpm nx affected --target=build --parallel=1 --configuration=development
149+
pnpm nx affected --target=build --parallel=1 --configuration=development $CACHE_FLAG
136150
fi
137151
env:
138152
DOCS_ENV: development
139153
NODE_ENV: production
140154
BASE_URL_PREFIX: /standards-dev/
155+
NX_SKIP_NX_CACHE: ${{ inputs.skip_nx_cache == 'true' && 'true' || '' }}
141156

142157
- name: Upload artifacts for each built project
143158
if: steps.affected.outputs.has-affected == 'true'

.github/workflows/nx-optimized-ci.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
pull_request:
88
branches: [main, dev]
99
workflow_dispatch:
10+
inputs:
11+
skip_nx_cache:
12+
description: 'Skip Nx cache (force fresh builds)'
13+
required: false
14+
default: 'false'
15+
type: boolean
1016

1117
env:
1218
NX_BRANCH: ${{ github.event.number || github.ref_name }}
@@ -17,6 +23,8 @@ env:
1723
# Fallback environment variables for sites that need them
1824
SITE_TITLE: IFLA Standards Portal
1925
SITE_TAGLINE: International Federation of Library Associations and Institutions
26+
# Skip Nx cache if requested via workflow dispatch
27+
NX_SKIP_NX_CACHE: ${{ inputs.skip_nx_cache == 'true' && 'true' || '' }}
2028

2129
jobs:
2230
ci:
@@ -54,5 +62,11 @@ jobs:
5462
run: pnpm install --no-frozen-lockfile
5563

5664
- name: Build affected projects for deployment validation
57-
run: npx nx affected --target=build --parallel=3
65+
run: |
66+
CACHE_FLAG=""
67+
if [ "$NX_SKIP_NX_CACHE" = "true" ]; then
68+
echo "Skipping Nx cache for fresh builds"
69+
CACHE_FLAG="--skip-nx-cache"
70+
fi
71+
npx nx affected --target=build --parallel=3 $CACHE_FLAG
5872

0 commit comments

Comments
 (0)