From 517977117f8b11d5260fe2b6582a303010ff4f3d Mon Sep 17 00:00:00 2001 From: himanshu goyal Date: Mon, 3 Feb 2025 23:16:02 +0530 Subject: [PATCH 1/2] update workflow to clean cache --- .github/workflows/lint.yml | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 52b9a06..e64bb53 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - name: Lint on: @@ -15,15 +12,34 @@ jobs: strategy: matrix: - node-version: [16.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + node-version: [18.x] steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npx prettier -c "**/*.js" - - run: npx eslint . + cache: 'npm' + + - name: Clean npm cache and remove node_modules + run: | + rm -rf node_modules package-lock.json + npm cache clean --force + + - name: Install dependencies + run: npm install + + - name: Verify package-lock.json + run: git diff --exit-code package-lock.json || (echo "package-lock.json changed, please commit updated lock file" && exit 1) + + - name: Run npm ci + run: npm ci + + - name: Run Prettier + run: npx prettier -c "**/*.js" + + - name: Run ESLint + run: npx eslint . From 9d05a8e6252a767e90ff81ad82119448b2ca6ef1 Mon Sep 17 00:00:00 2001 From: himanshu goyal Date: Mon, 3 Feb 2025 23:22:57 +0530 Subject: [PATCH 2/2] add verify package-lock step --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e64bb53..89b89fa 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,7 +22,7 @@ jobs: uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - cache: 'npm' + cache: "npm" - name: Clean npm cache and remove node_modules run: | @@ -33,7 +33,7 @@ jobs: run: npm install - name: Verify package-lock.json - run: git diff --exit-code package-lock.json || (echo "package-lock.json changed, please commit updated lock file" && exit 1) + run: git diff --exit-code package-lock.json || echo "⚠️ package-lock.json changed, please update it." - name: Run npm ci run: npm ci