Azure / Azure/azure-rest-api-specs

[EngSys] Use actions/cache for "npm ci" to improve perf

Open
#32,896 1 comment 0 reactions 1 assignee Claimed by @mikeharder View on GitHub
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

https://github.com/actions/cache/blob/main/examples.md#node---npm

On Linux, only improved perf of "npm ci" in repo root from 12s to 11s (including cache restore time), so not worth it for perf alone.

However, the cache may be more reliable, and prevent failures like this E429:

```
npm ci
npm error code E429
npm error 429 Too Many Requests - GET https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-08-26T07_10_24_348Z-debug-0.log
Error: Process completed with exit code 1.
```

https://github.com/Azure/azure-rest-api-specs/actions/runs/17230687842/job/48884070364?pr=36640#step:8:31

Root cause of 429 was an npmjs incident, so maybe this is expected to be rare?

https://status.npmjs.org/incidents/njwnds2vmdhz

Simplest option might be to use the caching feature builtin to setup-node:

https://github.com/actions/setup-node?tab=readme-ov-file#caching-global-packages-data

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.