name: Update Providers

on:
  schedule:
    - cron: "0 2 * * *" # Run nightly at 2 AM UTC
  workflow_dispatch: # Allow manual triggering

jobs:
  update-schema:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
      - run: go run . ./cmd/openrouter/main.go
      - uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v5
        with:
          commit_message: "chore: auto-update generated files"
          branch: main
          commit_user_name: actions-user
          commit_user_email: actions@github.com
          commit_author: actions-user <actions@github.com>
