name: CI Pipeline

on:
  workflow_call:
    inputs:
      checkout-ref:
        description: 'Git ref to checkout (empty for default merge commit)'
        type: string
        required: false
        default: ''

jobs:
  test:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: ['node']

    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          ref: ${{ inputs.checkout-ref || github.ref }}

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install project dependencies
        run: |
          npm install
          npm link

      - name: Run ESLint
        run: |
          npm run lint -- -- --report-unused-disable-directives --max-warnings 0
