Skip to content
Merged
Changes from all 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
131 changes: 131 additions & 0 deletions .github/workflows/update-vercle-models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Update Vercel Models

on:
schedule:
# Run every Monday at 8:00 AM Pacific Time (4:00 PM UTC)
- cron: '0 16 * * 1'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-models:
name: Update Vercel Models
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install Dependencies
run: bun install

- name: Generate Vercel models
run: bun run vercel:generate --new-only

- name: Check for changes
id: check-changes
run: |
if git diff --quiet providers/vercel/; then
echo "has-changes=false" >> "$GITHUB_OUTPUT"
echo "No changes detected in Vercel models"
else
echo "has-changes=true" >> "$GITHUB_OUTPUT"
echo "Changes detected in Vercel models"
git diff --stat providers/vercel/
fi

- name: Create branch and commit changes
if: steps.check-changes.outputs.has-changes == 'true'
id: create-branch
run: |
BRANCH_NAME="update-vercel-models-$(date +%Y%m%d-%H%M)"
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git checkout -b "$BRANCH_NAME"
git add providers/vercel/
git commit -m "chore(vercel): update Vercel model definitions

Auto-generated by weekly workflow from Vercel AI Gateway API.

Co-Authored-By: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
git push origin "$BRANCH_NAME"
echo "branch-name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"

- name: Create Pull Request
if: steps.check-changes.outputs.has-changes == 'true'
id: create-pr
run: |
PR_TITLE="chore(vercel): update Vercel model definitions"

PR_BODY="## Summary
This is an automated weekly update of Vercel model definitions from the [Vercel AI Gateway API](https://ai-gateway.vercel.sh/v1/models).

## Changes
- Updated model configurations in \`providers/vercel/models/\`
- Models may have been added, updated, or removed based on the current API response

## Review Checklist
- [ ] Check for new models and verify their configurations
- [ ] Review pricing changes for existing models
- [ ] Verify limit and modality updates
- [ ] Check for orphaned files (models no longer in API)

---
Generated by [\`update-vercel-models\`](.github/workflows/update-vercel-models.yml) workflow"

PR_URL=$(gh pr create \
--title "$PR_TITLE" \
--body "$PR_BODY" \
--base dev \
--head "${{ steps.create-branch.outputs.branch-name }}" \
--assignee sylviezhang37)

PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$')
echo "pr-url=$PR_URL" >> "$GITHUB_OUTPUT"
echo "pr-number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
echo "pr-title=$PR_TITLE" >> "$GITHUB_OUTPUT"
echo "PR created: $PR_URL"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: No changes
if: steps.check-changes.outputs.has-changes == 'false'
run: |
echo "No changes detected. Vercel models are already up to date."

- name: Send Slack notification to Vercel team
if: always()
run: |
if [ -z "$VERCEL_SLACK_WEBHOOK_URL" ]; then
echo "Slack webhook not configured. Skipping Slack notification."
echo "To enable Slack notifications, add VERCEL_SLACK_WEBHOOK_URL secret to repository settings."
exit 0
fi

if [ "$HAS_CHANGES" == "true" ]; then
MESSAGE="*Models.dev Update*\n\n PR created: <$PR_URL|#$PR_NUMBER - $PR_TITLE>\n\nReview needed: <@$REVIEWER>"
fi

curl -X POST "$VERCEL_SLACK_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "{\"channel\": \"$VERCEL_SLACK_CHANNEL\", \"text\": \"$MESSAGE\"}"
env:
VERCEL_SLACK_WEBHOOK_URL: ${{ secrets.VERCEL_SLACK_WEBHOOK_URL }}
VERCEL_SLACK_CHANNEL: "C0A7TF81HS5"
HAS_CHANGES: ${{ steps.check-changes.outputs.has-changes }}
PR_TITLE: ${{ steps.create-pr.outputs.pr-title }}
PR_URL: ${{ steps.create-pr.outputs.pr-url }}
PR_NUMBER: ${{ steps.create-pr.outputs.pr-number }}
REVIEWER: "U0A54KMV02E"