renovatebot-github/.github/actions/setup-node/action.yml
renovate[bot] 6b82695fd9
chore(deps): update actions/cache action to v5.0.2
| datasource  | package       | from   | to     |
| ----------- | ------------- | ------ | ------ |
| github-tags | actions/cache | v5.0.1 | v5.0.2 |
2026-01-16 18:22:29 +00:00

60 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@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
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@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
standalone: true
- name: ⚙️ Setup Node.js ${{ inputs.node-version }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.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@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: node_modules
key: ${{ env.CACHE_KEY }}
enableCrossOsArchive: true