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@v6
        with:
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

      - uses: actions/setup-go@v6
        with:
          go-version-file: go.mod

      - run: go run ./cmd/aihubmix/main.go
        continue-on-error: true

      - run: go run ./cmd/avian/main.go
        continue-on-error: true

      - run: go run ./cmd/neuralwatt/main.go
        continue-on-error: true

      - run: go run ./cmd/chutes/main.go
        continue-on-error: true

      - run: go run ./cmd/cortecs/main.go
        continue-on-error: true

      - run: go run ./cmd/huggingface/main.go
        continue-on-error: true

      - run: go run ./cmd/ionet/main.go
        continue-on-error: true

      - run: go run ./cmd/opencode-go/main.go
        continue-on-error: true

      - run: go run ./cmd/opencode-zen/main.go
        continue-on-error: true

      - run: go run ./cmd/openrouter/main.go
        continue-on-error: true

      - run: go run ./cmd/synthetic/main.go
        continue-on-error: true

      - run: go run ./cmd/venice/main.go
        continue-on-error: true

      - run: go run ./cmd/vercel/main.go
        continue-on-error: true

      - run: go run ./cmd/xai/main.go
        continue-on-error: true
        env:
          XAI_API_KEY: ${{ secrets.XAI_API_KEY }}

      - uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v5
        with:
          commit_message: "chore: auto-update generated files"
          branch: main
          commit_user_name: Charm
          commit_user_email: 124303983+charmcli@users.noreply.github.com
          commit_author: Charm <124303983+charmcli@users.noreply.github.com>
