Skip to content

Commit 8d38995

Browse files
committed
ci: Ensure we do not cache when running on master, release branch, or label
1 parent 88d66db commit 8d38995

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,16 @@ jobs:
174174
with:
175175
path: ${{ env.CACHED_BUILD_PATHS }}
176176
key: ${{ env.BUILD_CACHE_KEY }}
177+
177178
- name: NX cache
178179
uses: actions/cache@v3
180+
# Disable cache when:
181+
# - on master
182+
# - on release branches
183+
# - when PR has `ci-skip-cache` label
184+
if:
185+
github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release/') &&
186+
!github.event.pull_request.labels.contains('ci-skip-cache')
179187
with:
180188
path: node_modules/.cache/nx
181189
key: nx-${{ runner.os }}-${{ github.ref }}-${{ env.HEAD_COMMIT }}
@@ -185,6 +193,7 @@ jobs:
185193
nx-${{ runner.os }}-${{ github.ref }}-${{ env.HEAD_COMMIT }}
186194
nx-${{ runner.os }}-${{ github.ref }}
187195
nx-${{ runner.os }}
196+
188197
- name: Build packages
189198
# Under normal circumstances, using the git SHA as a cache key, there shouldn't ever be a cache hit on the built
190199
# packages, and so `yarn build` should always run. This `if` check is therefore only there for testing CI issues

0 commit comments

Comments
 (0)