|
1 | 1 | name: Sync AI Models |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - paths: |
6 | | - - '.github/workflows/sync-ai-models.yml' |
7 | | - - 'packages/openops/src/lib/ai/sync-models.ts' |
8 | 4 | schedule: |
9 | | - - cron: '0 0 * * 0' |
| 5 | + - cron: '0 12 * * 1' |
10 | 6 | workflow_dispatch: |
11 | 7 |
|
12 | 8 | permissions: |
@@ -45,42 +41,50 @@ jobs: |
45 | 41 | echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT |
46 | 42 | exit 0 |
47 | 43 |
|
48 | | - - name: Create Pull Request |
| 44 | + - name: Create branch and commit changes |
49 | 45 | 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 |
59 | 64 |
|
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). |
61 | 66 |
|
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. |
63 | 68 |
|
64 | | - ### What to Check |
| 69 | + ### What to Check |
65 | 70 |
|
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 |
69 | 74 |
|
70 | | - ### Testing Locally |
| 75 | + ### Testing Locally |
71 | 76 |
|
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 | + \`\`\` |
75 | 80 |
|
76 | | - --- |
| 81 | + --- |
77 | 82 |
|
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 |
84 | 88 |
|
85 | 89 | - name: Summary |
86 | 90 | if: always() |
|
0 commit comments