name: Check

on:
  pull_request:
    branches: [main]
    paths-ignore:
      - "**/*.md"
      - "docs-local/**"
      - ".github/ISSUE_TEMPLATE/**"
      - ".github/labeler.yml"
      - ".github/dependabot.yml"
      - "LICENSE"
      - "TRADEMARK.md"
      - "LEGAL.md"

concurrency:
  group: check-${{ github.head_ref }}
  cancel-in-progress: true

env:
  NODE_VERSION: "20"

jobs:
  lint-and-build:
    name: Lint & Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Install pnpm
        uses: pnpm/action-setup@v6
        with:
          version: 9

      - uses: actions/setup-node@v6
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: pnpm

      - name: Install dependencies
        run: pnpm install --frozen-lockfile

      - name: Lint
        run: pnpm lint

      - name: Type check
        run: pnpm exec tsc --noEmit

      - name: Build
        run: pnpm build
