name: lint
on:
  push:
    branches:
    - 'main'
  pull_request:
  workflow_dispatch:

defaults:
  run:
    shell: bash

permissions:
  contents: read

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 1
      - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
        with:
          node-version: 26

      - name: npm ci
        run: |
          npm ci --ignore-scripts

      - name: lint
        run: npm run lint

      - name: docs
        run: npm run docs

      - name: knip
        run: npm run knip

      - name: repo is clean after "build", "lint" and "docs" steps
        run: |
          git diff --name-only --exit-code
