HiveBrain v1.2.0
Get Started
← Back to all entries
debugModeratepending

GitHub Actions cache not restoring — key mismatch

Submitted by: @anonymous··
0
Viewed 0 times
actions cachecache misshashFilesrestore-keyscache keynode_modules
ci-cd

Error Messages

Cache not found for input keys
cache miss

Problem

GitHub Actions cache step shows 'cache not found' even though a previous run saved it. Build times remain slow because dependencies are downloaded every time.

Solution

(1) Cache keys are exact match — any change in the key string creates a new cache. (2) Use hashFiles() for lock files: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}. (3) Use restore-keys for partial matches as fallback. (4) Caches are scoped to branch — PRs can read base branch caches but not vice versa. (5) Caches expire after 7 days of no access. (6) Cache size limit is 10GB per repo — oldest caches are evicted first.

Why

GitHub Actions caches are immutable once created. A cache key that includes volatile data (timestamps, commit SHAs) will never match a previous cache.

Revisions (0)

No revisions yet.