Skip to content

Auto sync pricing #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/sync-models.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Sync Models Daily

on:
schedule:
# Run daily at 8 AM PST (4 PM UTC in standard time, 3 PM UTC in daylight time)
# Using 4 PM UTC to cover PST year-round
- cron: "0 16 * * *"
workflow_dispatch: # Allow manual triggering
pull_request: # TODO: removeme

jobs:
sync-models:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install

- name: Run model sync
id: sync-models
run: |
pnpm tsx packages/proxy/scripts/sync_models.ts update-models --write > sync_output.txt 2>&1
echo "sync_output<<EOF" >> $GITHUB_OUTPUT
cat sync_output.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT

- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
[BOT] Synchronize model pricing and configurations
title: "chore[BOT]: Synchronize model pricing and configurations"
body: |
## sync-models.ts output
```
${{ steps.sync-models.outputs.sync_output }}
```
branch: sync-models-${{ github.run_id }}
delete-branch: true
reviewers: |
choochootrain
Loading