Category: Automation

GitHub Actions: npm Cache Misses on Every Run

Read this guide in Polish

Another run re-downloads all dependencies despite the configured cache.

How to identify the source of the problem

Check package-lock.json, cache-dependency-path and whether the runner uses e.g. or any other manager.

Check the workflow event type, permissions joba, run ID and first failed step.

Repair steps

Set the lockfile path corresponding to the actual workspace and use the supported setup-node configuration.

How to Test Solution

The next run uses cache of dependencies with unchanged lockfile and continues to perform e.g.

Security and restrictions

Apply minimum token privileges and re-impotence. Do not remove main branch protection only for the convenience of the machine.