name: Docs And Style
on:
  push:
    branches: ["main"]
  pull_request:
  merge_group:

permissions:
  contents: read

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
      cancel-in-progress: true
    steps:
      - uses: actions/checkout@v5
      - name: Setup Node.js
        uses: actions/setup-node@v5
        with:
          node-version: '20'
      - name: Install markdown-link-check
        run: npm install -g markdown-link-check
      - name: Check Markdown links
        shell: bash
        run: |
          # To run this manually on Windows, run:
          #   npm install -g markdown-link-check
          #   Get-ChildItem -Recurse -Filter *.md | ForEach-Object { markdown-link-check $_.FullName -c .\.github\workflows\mlc_config.json }
          set -euo pipefail
          find . -type f -name "*.md" -not -path "./node_modules/*" \
            -exec markdown-link-check -c .github/workflows/mlc_config.json {} \;
