name: PR Check

on:
  pull_request:
    branches: [main, master]

jobs:
  validate:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
          cache-dependency-path: nextapp/package-lock.json

      - name: Install dependencies
        run: npm ci --prefix nextapp

      - name: TypeScript type check
        run: npx --prefix nextapp tsc --noEmit

      - name: ESLint
        run: npm run lint --prefix nextapp

      - name: Next.js build
        run: npm run build --prefix nextapp
        env:
          NEXT_TELEMETRY_DISABLED: 1
