Spaces:
Running
Running
| name: Update provider data | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' # daily at 06:00 UTC | |
| workflow_dispatch: # allow manual trigger from GitHub Actions UI | |
| permissions: | |
| contents: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - run: npm install | |
| - name: Fetch all provider data | |
| env: | |
| REQUESTY_API_KEY: ${{ secrets.REQUESTY_API_KEY }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| run: node scripts/fetch-providers.js | |
| - name: Commit if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add data/providers.json | |
| git diff --staged --quiet && echo "No changes." || ( | |
| git commit -m "chore: update provider data [skip ci]" && | |
| git pull --rebase origin main && | |
| git push origin main | |
| ) | |
| - name: Sync to Hugging Face | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| if [ -z "$HF_TOKEN" ]; then | |
| echo "HF_TOKEN is not set, skipping sync." | |
| exit 0 | |
| fi | |
| git remote add hf https://cstr:$HF_TOKEN@huggingface.co/spaces/cstr/LLMProviders || true | |
| # Prepend metadata only for the HF version of README | |
| cat .huggingface/space.yml README.md > HF_README.md | |
| mv HF_README.md README.md | |
| git commit -am "chore: sync to Hugging Face with metadata" || true | |
| git push hf main --force | |