name: Update index.yaml
on:
  schedule:
    - cron: '25 2 * * *'
jobs:
  update_index:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
    - uses: actions/checkout@v4
    
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.x'
        
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pyyaml
  
    - name: Pull latest changes
      run: git pull origin main
    
    - name: Run auto-update script
      run: python Utilities/auto-update-index.py . index.yaml
      
    - name: Commit index.yaml
      uses: stefanzweifel/git-auto-commit-action@v4
      with:
        commit_message: Updating index.yaml
        file_pattern: index.yaml
