The dependency cache keeps downloaded packages (npm, Composer, pip folder...) between runs to speed up the pipeline. It is identified by a key, often derived from the lock file's hash; when that file changes, the cache is rebuilt.
Example
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}