Skip to content

Commit 04709a9

Browse files
fix time
1 parent 7d47b3b commit 04709a9

2 files changed

Lines changed: 37 additions & 33 deletions

File tree

.github/workflows/sync-ai-models.yml

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
name: Sync AI Models
22

33
on:
4-
pull_request:
5-
paths:
6-
- '.github/workflows/sync-ai-models.yml'
7-
- 'packages/openops/src/lib/ai/sync-models.ts'
84
schedule:
9-
- cron: '0 0 * * 0'
5+
- cron: '0 12 * * 1'
106
workflow_dispatch:
117

128
permissions:
@@ -45,42 +41,50 @@ jobs:
4541
echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
4642
exit 0
4743
48-
- name: Create Pull Request
44+
- name: Create branch and commit changes
4945
if: steps.check-models.outputs.exit_code == '1'
50-
id: create-pr
51-
uses: peter-evans/create-pull-request@v7
52-
with:
53-
token: ${{ secrets.GITHUB_TOKEN }}
54-
base: main
55-
commit-message: 'Update AI provider models from models.dev'
56-
title: 'Update AI Provider Models'
57-
body: |
58-
## 🤖 Automated Model Sync
46+
id: create-branch
47+
run: |
48+
git config user.name "github-actions[bot]"
49+
git config user.email "github-actions[bot]@users.noreply.github.com"
50+
git switch -C "sync-ai-models-${{ github.run_number }}"
51+
git add packages/openops/src/lib/ai/providers/
52+
git commit -m "Update AI provider models from models.dev"
53+
echo "has_changes=true" >> $GITHUB_OUTPUT
54+
55+
- name: Push changes and create PR
56+
if: steps.create-branch.outputs.has_changes == 'true'
57+
env:
58+
GITHUB_TOKEN: ${{ github.token }}
59+
run: |
60+
git push origin "sync-ai-models-${{ github.run_number }}"
61+
gh pr create \
62+
--title "Update AI Provider Models" \
63+
--body "## 🤖 Automated Model Sync
5964
60-
This PR updates AI provider model lists based on the latest data from [models.dev](https://models.dev).
65+
This PR updates AI provider model lists based on the latest data from [models.dev](https://models.dev).
6166
62-
**Review the file changes** to see which models were added or removed for each provider.
67+
**Review the file changes** to see which models were added or removed for each provider.
6368
64-
### What to Check
69+
### What to Check
6570
66-
- ✅ New models are legitimate and available
67-
- ✅ Removed models are actually deprecated/retired
68-
- ✅ Model IDs match provider documentation
71+
- ✅ New models are legitimate and available
72+
- ✅ Removed models are actually deprecated/retired
73+
- ✅ Model IDs match provider documentation
6974
70-
### Testing Locally
75+
### Testing Locally
7176
72-
```bash
73-
npx tsx packages/openops/src/lib/ai/sync-models.ts
74-
```
77+
\`\`\`bash
78+
npx tsx packages/openops/src/lib/ai/sync-models.ts
79+
\`\`\`
7580
76-
---
81+
---
7782
78-
🔗 **Source**: https://models.dev/api.json (MIT License)
79-
branch: sync-ai-models-${{ github.run_number }}
80-
delete-branch: true
81-
labels: |
82-
dependencies
83-
automated
83+
🔗 **Source**: https://models.dev/api.json (MIT License)" \
84+
--base main \
85+
--head "sync-ai-models-${{ github.run_number }}" \
86+
--label dependencies \
87+
--label automated
8488
8589
- name: Summary
8690
if: always()

packages/openops/src/lib/ai/sync-models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function filterTextOnlyModels(models: Record<string, ModelData>): string[] {
111111
return true;
112112
})
113113
.map((model) => model.id)
114-
.sort();
114+
.sort((a, b) => a.localeCompare(b));
115115
}
116116

117117
function getProviderFilePath(providerFileName: string): string {

0 commit comments

Comments
 (0)