name: PR Build Check

on:
  pull_request:
    branches:
      - '**'

jobs:
  build:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'
          
      - name: Install dependencies
        run: npm install --force

      - name: Generate Prisma Client
        run: npx prisma generate
        
      - name: Build
        run: npm run build
        env:
          NEXT_PUBLIC_URL: 'http://localhost:3005'
          NEXT_PUBLIC_FORECAST_URL: 'http://localhost:3005'
          DATABASE_URL: 'postgresql://dummy:dummy@localhost:5432/dummy'
          SMTP_EMAIL: 'dummy@example.com'
          SMTP_EMAIL_PASSWORD: 'dummy'
          NEXT_PUBLIC_PLAUSIBLE_DOMAIN: 'localhost'
          JWT_SECRET: 'dummy_secret'
          JWT_REFRESH_SECRET: 'dummy_refresh_secret'