GitHub Actions not caching Node modules between workflow runs despite using actions/cache
I'm integrating two systems and I've looked through the documentation and I'm still confused about I'm having trouble getting caching to work with my GitHub Actions workflow for a Node.js project... Iโve set up the cache action to store my `node_modules`, but every time the workflow runs, it seems to be reinstalling all the dependencies instead of using the cached version. Hereโs a snippet of my workflow YAML file: ```yaml name: CI on: push: branches: - main pull_request: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Cache Node modules uses: actions/cache@v2 with: path: node_modules key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Install Dependencies run: | npm install - name: Run Tests run: | npm test ``` Iโm using Node.js version 14.x and npm version 6.14.8. The question is that the cache isn't being restored, and I see logs like `Cache not found for input keys: ubuntu-latest-node-[hash]`. Iโve double-checked the `package-lock.json` file, and it is being tracked in Git. The cache key should be unique to the state of my dependencies, yet it seems like it's always missing. Iโve also tried simplifying the cache key to just `key: ${{ runner.os }}-node` but that didn't help either. Any ideas on what might be going wrong? Am I missing any configuration or using the cache action incorrectly? This is happening in both development and production on CentOS. Any examples would be super helpful. For context: I'm using Yaml on Ubuntu 20.04. Any advice would be much appreciated.