name: TypeScript Compilation

on:
  # Trigger the workflow on push and pull requests to main branch
  push:
    branches: ['main']
  pull_request:
    branches: ['main']

jobs:
  build:
    # Using the latest Ubuntu runner
    runs-on: ubuntu-latest

    steps:
      # Checkout the repository code
      - uses: actions/checkout@v4

      # Set up Node.js with specific version
      - name: Use Node.js 20.13.1
        uses: actions/setup-node@v4
        with:
          node-version: 20.13.1
          cache: 'yarn'

      # Install dependencies using Yarn
      - name: Install dependencies
        run: yarn install --frozen-lockfile

      # Run TypeScript compiler
      - name: Run TypeScript Compilation
        run: yarn tsc --noEmit
