11name : Fetch AI Models
22
33on :
4- schedule :
5- # Run daily at 06:00 UTC
6- - cron : ' 0 6 * * *'
74 workflow_dispatch :
85 inputs :
96 providers :
2623jobs :
2724 fetch-and-update :
2825 runs-on : ubuntu-latest
26+ permissions :
27+ contents : write
28+ pull-requests : write
2929
3030 steps :
3131 - name : Checkout repository
@@ -102,8 +102,67 @@ jobs:
102102 echo "timestamp=$(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
103103 echo "date_short=$(date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
104104
105- - name : Commit and push updates
106- if : github.ref_type != 'tag'
105+ - name : Create Pull Request with updates
106+ if : github.ref_type != 'tag' && github.event_name != 'push'
107+ run : |
108+ git config --local user.email "action@github.com"
109+ git config --local user.name "GitHub Action"
110+
111+ # Copy generated files to provider_configs for direct access
112+ cp -r dist/* provider_configs/ || true
113+
114+ # Check if there are changes
115+ git add provider_configs/
116+ if ! git diff --staged --quiet; then
117+ # Create a new branch for the PR
118+ BRANCH_NAME="update-models-$(date -u +%Y%m%d-%H%M%S)"
119+ git checkout -b "$BRANCH_NAME"
120+
121+ # Commit changes
122+ git commit -m "π€ Update model configurations - $(date -u +%Y-%m-%d)"
123+
124+ # Push to remote
125+ git push origin "$BRANCH_NAME"
126+
127+ # Create PR using GitHub CLI
128+ gh pr create \
129+ --title "π€ Update AI Model Configurations" \
130+ --body "$(cat <<'EOF'
131+ # # π€ Automated Model Configuration Update
132+
133+ **Generated:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')
134+ **Total Models:** ${{ steps.release_info.outputs.total_models }}
135+ **Providers:** ${{ steps.release_info.outputs.provider_count }} (${{ steps.release_info.outputs.providers }})
136+
137+ # ## π Changes
138+ - Updated model configurations from provider APIs
139+ - Refreshed capability detection (vision, function calling, reasoning)
140+ - Generated standardized JSON format files
141+
142+ # ## π Files Updated
143+ - ` provider_configs/*.json` - Individual provider configurations
144+ - ` provider_configs/all.json` - Aggregated model data
145+
146+ # ## β
Validation
147+ - [x] JSON syntax validation passed
148+ - [x] Model data structure validation passed
149+ - [x] Provider capability detection completed
150+
151+ ---
152+
153+ *This PR was automatically created by GitHub Actions.*
154+ EOF
155+ )" \
156+ --head "$BRANCH_NAME" \
157+ --base main
158+ else
159+ echo "No changes to commit"
160+ fi
161+ env :
162+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
163+
164+ - name : Direct commit (for push events)
165+ if : github.ref_type != 'tag' && github.event_name == 'push'
107166 run : |
108167 git config --local user.email "action@github.com"
109168 git config --local user.name "GitHub Action"
@@ -120,24 +179,19 @@ jobs:
120179 fi
121180
122181 - name : Create Release Assets
182+ if : github.ref_type == 'tag'
123183 run : |
124184 # Create tarball of all JSON files with proper naming
125185 cd dist
126- if [ "${{ github.ref_type }}" = "tag" ]; then
127- # For tag releases, use the tag name
128- TAG_NAME="${{ github.ref_name }}"
129- tar -czf "../provider-configs-${TAG_NAME}.tar.gz" *.json
130- # Also create individual provider archives
131- for file in *.json; do
132- if [ "$file" != "all.json" ]; then
133- provider_name=$(basename "$file" .json)
134- tar -czf "../${provider_name}-${TAG_NAME}.tar.gz" "$file"
135- fi
136- done
137- else
138- # For scheduled/manual runs, use date
139- tar -czf "../provider-configs-${{ steps.release_info.outputs.date_short }}.tar.gz" *.json
140- fi
186+ TAG_NAME="${{ github.ref_name }}"
187+ tar -czf "../provider-configs-${TAG_NAME}.tar.gz" *.json
188+ # Also create individual provider archives
189+ for file in *.json; do
190+ if [ "$file" != "all.json" ]; then
191+ provider_name=$(basename "$file" .json)
192+ tar -czf "../${provider_name}-${TAG_NAME}.tar.gz" "$file"
193+ fi
194+ done
141195 cd ..
142196
143197 - name : Upload Artifacts (non-tag)
@@ -147,42 +201,8 @@ jobs:
147201 name : provider-configs-${{ steps.release_info.outputs.date_short }}
148202 path : |
149203 dist/*.json
150- provider-configs-*.tar.gz
151204 retention-days : 30
152205
153- - name : Create Release (scheduled)
154- if : github.event_name == 'schedule'
155- uses : softprops/action-gh-release@v1
156- with :
157- tag_name : auto-${{ steps.release_info.outputs.date_short }}
158- name : Daily Auto Release ${{ steps.release_info.outputs.date_short }}
159- body : |
160- π€ **Automated Daily Release of AI Model Configurations**
161-
162- **Generated:** ${{ steps.release_info.outputs.timestamp }}
163- **Total Models:** ${{ steps.release_info.outputs.total_models }}
164- **Providers:** ${{ steps.release_info.outputs.provider_count }} (${{ steps.release_info.outputs.providers }})
165-
166- ## π¦ What's Included
167-
168- This release contains the latest model information from all configured providers:
169- - `provider-configs-${{ steps.release_info.outputs.date_short }}.tar.gz` - Complete package with all provider data
170- - Individual JSON files for each provider
171- - Aggregated JSON with all models combined
172-
173- ## π How to Use
174-
175- Download and extract the files to access standardized AI model configurations for your applications.
176-
177- ```bash
178- # Download and extract
179- wget https://github.com/${{ github.repository }}/releases/download/auto-${{ steps.release_info.outputs.date_short }}/provider-configs-${{ steps.release_info.outputs.date_short }}.tar.gz
180- tar -xzf provider-configs-${{ steps.release_info.outputs.date_short }}.tar.gz
181- ```
182- files : provider-configs-*.tar.gz
183- draft : false
184- prerelease : false
185-
186206 - name : Create Release (tagged)
187207 if : github.ref_type == 'tag'
188208 uses : softprops/action-gh-release@v1
0 commit comments