name: Prevent Direct README Changes

on:
  pull_request:
    paths:
      - "README.md"

jobs:
  check-readme:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4.2.2

      - name: Detect direct README changes
        run: |
          if git diff --name-only origin/main | grep -q "README.md"; then
            echo "❌ Direct modifications to README.md are not allowed!"
            echo "Please update README.template.md instead."
            exit 1
          fi
