name: mindmodel scheduled validate

on:
  schedule:
    - cron: '0 0 * * 0' # weekly

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install uv
        uses: astral-sh/setup-uv@v5
        with:
          version: "0.6.x"

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.13"

      - name: Install dependencies
        run: uv sync --locked

      - name: Run tests
        run: uv run pytest tests/ -q

      - name: Run mindmodel validator if manifest exists
        if: ${{ always() }}
        run: |
          if [ -f .mindmodel/manifest.yaml ]; then
            uv run python -m scripts.mindmodel.cli || true
          else
            echo "No .mindmodel/manifest.yaml present — skipping validator"
          fi
