name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build:
    name: build & test (node ${{ matrix.node }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        node: [20, 22, 24]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - name: Type check
        run: npx tsc --noEmit
      - name: Tests
        run: npm test
      - name: Build
        run: npm run build
      - name: CLI smoke test
        run: |
          # Use a tiny public repo with low traffic so the test is deterministic
          # and the rate-limit-free anonymous endpoint is sufficient.
          node ./dist/cli.js octocat/Hello-World --limit-issues 1 --limit-pulls 1 --limit-releases 1 --limit-contributors 1
