name: update-contributors

on:
  repository_dispatch:
  workflow_dispatch:
  schedule:
    - cron: "00 20 1 * *"

jobs:
  updateContributors:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.10'
          cache: 'pip'
      - run: pip install -r requirements.txt
      - run: |
          ./hack/contributors.py
        env:
          GITHUB_TOKEN: ${{secrets.BOT_GITHUB_TOKEN}}
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v6
        with:
          title: Update contributors section
          signoff: true
          token: ${{secrets.BOT_GITHUB_TOKEN}}
