Skip to content

chore(ci): Cache node_modules#1443

Merged
Tobbe merged 1 commit intomainfrom
tobbe-chore-ci-cache-node-modules
Mar 23, 2026
Merged

chore(ci): Cache node_modules#1443
Tobbe merged 1 commit intomainfrom
tobbe-chore-ci-cache-node-modules

Conversation

@Tobbe
Copy link
Copy Markdown
Member

@Tobbe Tobbe commented Mar 23, 2026

From AI's reasoning

Key design choice: These two new caches intentionally do not include ${{ github.run_id }} in the primary key (unlike the Yarn global cache and install state entries). That's correct here — you want an exact cache hit when lock files are unchanged, so the link/build step is skipped on the next run. The existing caches use run_id because they benefit from always being refreshed; node_modules only needs updating when dependencies actually change.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 23, 2026

Deploy Preview for cedarjs canceled.

Name Link
🔨 Latest commit 5eb9f07
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/69c12970011e9f00086f2aa2

@github-actions github-actions Bot added this to the chore milestone Mar 23, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 23, 2026

Greptile Summary

This PR extends the set-up-yarn-cache composite action to also cache node_modules directories, complementing the existing yarn global cache and install-state caches. Since the repo uses nodeLinker: node-modules (confirmed in .yarnrc.yml), caching node_modules directly avoids Yarn's link/hoist step on cache hits, which can be a significant time saving in CI.

  • Adds a cache step for the root node_modules keyed on yarn.lock, package.json, and .yarnrc.yml hashes — correctly includes .yarnrc.yml since linker config changes affect the installed layout.
  • Adds a separate cache step for packages/create-cedar-rsc-app/node_modules, which has its own yarn.lock (a standalone sub-workspace). The key omits .yarnrc.yml — correct, since packages/create-cedar-rsc-app does not have its own .yarnrc.yml.
  • Both new steps use actions/cache@v5, consistent with the existing steps in the action.
  • The broad restore-keys fallback (node-modules-${{ runner.os }}-) is standard practice; a partial hit still allows yarn install to patch up any differences before proceeding.

Confidence Score: 5/5

  • Safe to merge — a targeted CI caching improvement with no impact on application code or correctness.
  • The change is confined to a single composite action file, uses the same actions/cache@v5 version already in use, and the cache keys are correctly derived from the relevant lock files and config. The repo's nodeLinker: node-modules setting confirms that caching node_modules is the right strategy. No logic or application code is touched.
  • No files require special attention.

Important Files Changed

Filename Overview
.github/actions/set-up-yarn-cache/action.yml Adds two new cache steps for root node_modules and packages/create-cedar-rsc-app/node_modules; straightforward and correct for the nodeLinker: node-modules setup confirmed in .yarnrc.yml.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[set-up-yarn-cache action] --> B[Get yarn cache directory]
    B --> C[Cache yarn's global cache\nyarn-cache-OS-run_id]
    C --> D[Cache yarn install state\nyarn-install-state-OS-hash-run_id]
    D --> E["♻️ Cache root node_modules\nnode-modules-OS-hash(yarn.lock,package.json,.yarnrc.yml)"]
    E --> F["♻️ Cache create-cedar-rsc-app node_modules\nnode-modules-create-cedar-rsc-app-OS-hash(yarn.lock,package.json)"]

    style E fill:#90EE90
    style F fill:#90EE90
Loading

Reviews (1): Last reviewed commit: "chore(ci): Cache node_modules" | Re-trigger Greptile

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Mar 23, 2026

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 5eb9f07

Command Status Duration Result
nx run-many -t build:pack --exclude create-ceda... ✅ Succeeded 7s View ↗
nx run-many -t build ✅ Succeeded 3m 13s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-23 12:41:55 UTC

@Tobbe Tobbe force-pushed the tobbe-chore-ci-cache-node-modules branch from 9363052 to 5eb9f07 Compare March 23, 2026 11:52
@Tobbe Tobbe merged commit 3bea417 into main Mar 23, 2026
66 of 69 checks passed
@Tobbe Tobbe deleted the tobbe-chore-ci-cache-node-modules branch March 23, 2026 13:01
Tobbe added a commit that referenced this pull request Mar 25, 2026
@Tobbe Tobbe modified the milestones: chore, v3.1.0 Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant