name: CI / Setup
description: Common setup steps for Github Actions

inputs:
  node-version:
    description: "Node.js version"
    required: true
    default: "22.x"
  install-packages:
    description: "Install packages"
    required: false
    default: "true"

runs:
  using: "composite"
  steps:
    - name: ✅ Checkout code
      uses: actions/checkout@v5

    - name: 🎬 Setup pnpm
      uses: pnpm/action-setup@v4

    - name: 🔨 Setup Node.js ${{ inputs.node-version }}
      uses: actions/setup-node@v6
      with:
        node-version: ${{ inputs.node-version }}
        cache: "pnpm"

    - name: 🔌 Install
      if: ${{ inputs.install-packages == 'true' }}
      shell: bash
      run: pnpm install
