From d2fc2b4714df68af7ab1033609806e9af9a0bdbe Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 11 Apr 2024 09:52:36 -0700 Subject: [PATCH] chore: simplify (#50) * Reset workspace permissions no longer needed * Use caching in setup-node * cache-dependency-path * Restore ownership reset --- action.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index ce21ff4..4ba48a4 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,10 @@ inputs: required: true ### Typical / recommended + cache: + description: Package manager for caching; e.g. npm, yarn, pnpm + default: npm + sonar_args: # https://docs.sonarcloud.io/advanced-setup/analysis-parameters/ description: SonarCloud command line arguments @@ -97,23 +101,15 @@ runs: if: steps.diff.outputs.triggered == 'true' with: node-version: ${{ inputs.node_version }} - - id: npm-cache-dir - if: steps.diff.outputs.triggered == 'true' - shell: bash - run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 - if: steps.diff.outputs.triggered == 'true' - with: - path: ${{ steps.npm-cache-dir.outputs.dir }} - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-node- + cache: ${{ inputs.cache }} + cache-dependency-path: ${{ inputs.dir }}/package-lock.json # Run tests, hopefully generating coverage for SonarCloud - - name: Run Tests - if: steps.diff.outputs.triggered == 'true' + - if: steps.diff.outputs.triggered == 'true' shell: bash + working-directory: ${{ inputs.dir }} run: | - cd ${{ inputs.dir }} + # Run Tests ${{ inputs.commands }} ### Optional SonarCloud