Skip to main content
Module

x/value_schema/.github/actions/cache-npm/action.yml

simple, easy-to-use, and declarative input validator; supports Node.js, TypeScript, Deno, and Bun
Go to Latest
File
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-actionname: Cache NPMdescription: Composite action (cache NPM)
inputs: os: description: host OS that CI 'runs-on' required: true node-version: description: Node.js version required: true
runs: using: composite steps: # https://github.com/actions/cache/blob/master/examples.md#node---npm # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter - name: Get NPM cache directory run: echo "NPM_CACHE_DIRECTORY=$(npm config get cache)" >> ${{ github.env }} # use "github.env" instead of "github.output"; if use "github.output", "Warning: Input required and not supplied: path" is displayed on post-process shell: pwsh # use PowerShell; Bash doesn't work on Windows because the value of "github.env" is like "D:\a\_temp\_runner_file_commands\set_env_XXX".
- name: Cache NPM modules uses: actions/cache@v3 with: path: ${{ env.NPM_CACHE_DIRECTORY }} key: npm-${{ inputs.os }}-${{ inputs.node-version }}-${{ hashFiles('package-lock.json') }} restore-keys: | npm-${{ inputs.os }}-${{ inputs.node-version }}- npm-${{ inputs.os }}-