name: Check Code Quality

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  prettier:
    name: Run Prettier check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: npm
      - name: Install dependencies
        run: npm ci
      - name: Run Prettier
        run: npm run prettier:check

  typescript:
    name: Check TypeScript types
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: npm
      - name: Install dependencies
        run: npm ci
      - name: Run TypeScript types check
        run: npm run ts:check
