From 9ba78b5d37b52aeae18016f1487b7866b59564ca Mon Sep 17 00:00:00 2001 From: chrisdca Date: Mon, 7 Jul 2025 12:22:25 -0500 Subject: [PATCH] feat: add cache for node modules --- .github/workflows/cache-node.yml | 27 +++++++++++++++++++++++++++ .github/workflows/cache.yml | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/cache-node.yml diff --git a/.github/workflows/cache-node.yml b/.github/workflows/cache-node.yml new file mode 100644 index 0000000..62f43ca --- /dev/null +++ b/.github/workflows/cache-node.yml @@ -0,0 +1,27 @@ +name: Cache Node Workflow +on: workflow_dispatch +permissions: + contents: write +jobs: + cache-setup: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Cache Node Modules + id: cache-npm + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + path: node_modules + key: ${{ runner.os }}-${{env.cache-name}}-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-${{env.cache-name}}- + ${{ runner.os }}- + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - name: Install Dependencies + run: npm install diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index c010037..8ec601d 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -1,4 +1,4 @@ -name: Cache Workflow +name: Cache NPM Workflow on: workflow_dispatch permissions: contents: write @@ -15,7 +15,7 @@ jobs: cache-name: cache-npm with: path: ~/.npm - key: ${{ runner.os }}-${{env.cache-name}}-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-${{env.cache-name}}-${{ hashFiles('package-lock.json') }} restore-keys: | ${{ runner.os }}-${{env.cache-name}}- ${{ runner.os }}-