Skip to content

Cache npm packages in CI - #8213

Open
Amaury Chamayou (achamayou) wants to merge 3 commits into
mainfrom
achamayou-supreme-memory
Open

Cache npm packages in CI#8213
Amaury Chamayou (achamayou) wants to merge 3 commits into
mainfrom
achamayou-supreme-memory

Conversation

@achamayou

@achamayou Amaury Chamayou (achamayou) commented Aug 26, 2026

Copy link
Copy Markdown
Member

CI jobs repeatedly download the same npm packages even though their RPM dependencies are already cached. This adds equivalent npm download caching to reduce registry traffic and improve resilience to transient package fetch failures.

Inspired by the RPM cache introduced in #8196.

Summary

  • cache /github/home/.npm in the shared Azure Linux dependency action
  • rotate immutable caches weekly and key them by architecture, npm dependency inputs, and job
  • restore compatible caches across jobs to reuse common packages
  • document the RPM and npm cache behavior

Validation

  • populated, archived, and restored the npm cache under WSL2
  • installed the CI Prettier dependencies from the restored cache using strict offline mode
  • ran Prettier from the offline installation
  • ran the repository Prettier and ASCII checks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 26, 2026 14:00
@achamayou
Amaury Chamayou (achamayou) requested a review from a team as a code owner August 26, 2026 14:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds npm download caching to the existing shared Azure Linux dependency composite action, complementing the existing weekly-rotated RPM cache to reduce repeated registry traffic and improve CI resilience.

Changes:

  • Extend the shared Azure Linux dependency action to restore/save the npm cache directory (/github/home/.npm) using actions/cache.
  • Key npm caches by architecture, dependency inputs (package.json + scripts/prettier-checks.sh), job, and weekly rotation date; add broader restore prefixes for cross-job reuse.
  • Update workflow documentation to describe both RPM and npm caching behavior and rollover semantics.

Custom instructions used:

  • None (no repository instruction files from .github/copilot-instructions.md or .github/instructions/ were loaded via tools during this review).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/README.md Updates CI workflow documentation to cover both RPM and npm caching and weekly rollover behavior.
.github/actions/install-ci-dependencies/action.yml Adds an npm cache restore/save step alongside the existing weekly-rotated RPM cache in the shared Azure Linux dependency action.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants