@@ -882,6 +882,12 @@ jobs:
882882 dependency_cache_key : ${{ needs.job_build.outputs.dependency_cache_key }}
883883 - name : NX cache
884884 uses : actions/cache/restore@v4
885+ # Disable cache when:
886+ # - on release branches
887+ # - when PR has `ci-skip-cache` label or on nightly builds
888+ if : |
889+ needs.job_get_metadata.outputs.is_release == 'false' &&
890+ needs.job_get_metadata.outputs.force_skip_cache == 'false'
885891 with :
886892 path : .nxcache
887893 key : nx-Linux-${{ github.ref }}-${{ env.HEAD_COMMIT }}
@@ -893,6 +899,10 @@ jobs:
893899
894900 - name : Stores tarballs in cache
895901 uses : actions/cache/save@v4
902+ # Skip saving cache on release branches or when ci-skip-cache label is set
903+ if : |
904+ needs.job_get_metadata.outputs.is_release == 'false' &&
905+ needs.job_get_metadata.outputs.force_skip_cache == 'false'
896906 with :
897907 path : ${{ github.workspace }}/packages/*/*.tgz
898908 key : ${{ env.BUILD_CACHE_TARBALL_KEY }}
@@ -961,6 +971,10 @@ jobs:
961971 - name : Restore tarball cache
962972 uses : actions/cache/restore@v4
963973 id : restore-tarball-cache
974+ # Skip restoring tarball cache on release branches or when ci-skip-cache label is set
975+ if : |
976+ needs.job_get_metadata.outputs.is_release == 'false' &&
977+ needs.job_get_metadata.outputs.force_skip_cache == 'false'
964978 with :
965979 path : ${{ github.workspace }}/packages/*/*.tgz
966980 key : ${{ env.BUILD_CACHE_TARBALL_KEY }}
@@ -1082,6 +1096,10 @@ jobs:
10821096 - name : Restore tarball cache
10831097 uses : actions/cache/restore@v4
10841098 id : restore-tarball-cache
1099+ # Skip restoring tarball cache on release branches or when ci-skip-cache label is set
1100+ if : |
1101+ needs.job_get_metadata.outputs.is_release == 'false' &&
1102+ needs.job_get_metadata.outputs.force_skip_cache == 'false'
10851103 with :
10861104 path : ${{ github.workspace }}/packages/*/*.tgz
10871105 key : ${{ env.BUILD_CACHE_TARBALL_KEY }}
0 commit comments