name: Observatory Update
on:
  schedule:
    - cron: '0 6 * * 1'  # Mondays 6am UTC
  workflow_dispatch:
jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Install dependencies
        run: pip install -e ".[dev]"
      - name: Install Ollama
        run: |
          curl -fsSL https://ollama.com/install.sh | sh
          ollama serve &
          sleep 5
          ollama pull nomic-embed-text
      - name: Run observatory update
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
        run: ietf observatory update --source ietf,w3c
      - name: Generate dashboard
        run: ietf observatory dashboard
      - name: Commit and push
        run: |
          git config user.name "Observatory Bot"
          git config user.email "bot@example.com"
          git add docs/ data/drafts.db
          git diff --staged --quiet || git commit -m "Observatory update $(date +%Y-%m-%d)"
          git push
