name: Build Validation

on:
  pull_request:
    branches: [main]

jobs:
  validate-manuscript:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.x'
          
      - name: Run Chapter Validation
        run: |
          # Run the build script with --md flag which triggers validation
          # If validation fails, the script exits with code 1, failing the CI
          python3 build/build.py --md
