name: "Install Dependencies"
description: "Install pnpm, Node.js, and project dependencies"

inputs:
  filter:
    description: "pnpm --filter value to scope install (e.g. '@cloudflare/kumo'). Omit for all packages."
    required: false

runs:
  using: "composite"
  steps:
    - name: Install pnpm
      uses: pnpm/action-setup@v4
      with:
        version: 10.22.0

    - name: Install Node.js
      uses: actions/setup-node@v4
      with:
        node-version: 24
        cache: "pnpm"
        registry-url: "https://registry.npmjs.org"

    - name: Install dependencies
      shell: bash
      run: |
        if [ -n "${{ inputs.filter }}" ]; then
          pnpm install --frozen-lockfile --filter "${{ inputs.filter }}"
        else
          pnpm install --frozen-lockfile
        fi
