name: PR Check

on:
  push:
    branches:
      - main
      - internal
  pull_request:
    branches:
      - main
      - internal

permissions:
  contents: read

concurrency:
  group: pr-check-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  validate:
    name: Lint, Check, Test and Build
    runs-on: ubuntu-latest
    timeout-minutes: 20

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Bun
        uses: oven-sh/setup-bun@v2
        with:
          bun-version: '1.3.1'

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

      - name: Lint
        run: bun run lint

      - name: Check
        run: bun run check

      - name: Test
        run: bun run test

      - name: Build
        run: bun run build
