Files
github-action/.github/actions/setup-node/action.yml
T
renovate[bot] 9c823d4f8f chore(deps): update pnpm/action-setup action to v6.1.1
| datasource  | package           | from   | to     |
| ----------- | ----------------- | ------ | ------ |
| github-tags | pnpm/action-setup | v6.1.0 | v6.1.1 |
2026-11-03 14:17:28 +00:00

61 lines
1.8 KiB
YAML

name: 'Setup Node.js'
description: 'Setup Node and install dependencies using cache'
inputs:
save-cache:
description: 'Save cache when needed'
required: false
default: 'false'
runs:
using: 'composite'
steps:
- name: ⚙️ Calculate `CACHE_KEY`
shell: bash
run: |
echo 'CACHE_KEY=node_modules-${{
hashFiles('.node-version', 'pnpm-lock.yaml')
}}' >> "$GITHUB_ENV"
- name: ♻️ Restore `node_modules`
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: node-modules-restore
with:
path: node_modules
key: ${{ env.CACHE_KEY }}
enableCrossOsArchive: true
- name: Calculate `CACHE_HIT`
shell: bash
run: |
echo 'CACHE_HIT=${{
(steps.node-modules-restore.outputs.cache-hit == 'true') && 'true' || ''
}}' >> "$GITHUB_ENV"
- name: ⚙️ Setup pnpm
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
standalone: true
- name: ⚙️ Setup Node.js ${{ inputs.node-version }}
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: ${{ env.CACHE_HIT != 'true' && 'pnpm' || '' }}
- name: 📥 Install dependencies
if: env.CACHE_HIT != 'true'
shell: bash
run: pnpm install --frozen-lockfile
env:
# Other environment variables
HUSKY: '0' # By default do not run HUSKY install
- name: ♻️ Write `node_modules` cache
if: inputs.save-cache == 'true' && env.CACHE_HIT != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: node_modules
key: ${{ env.CACHE_KEY }}
enableCrossOsArchive: true