|
6 | 6 | paths: |
7 | 7 | - .github/workflows/check-models.yml |
8 | 8 | - .github/scripts/scrape-models.sh |
| 9 | + - src/tokenEstimators.json |
| 10 | + - src/modelPricing.json |
9 | 11 |
|
10 | 12 | schedule: |
11 | 13 | - cron: '11 17 * * 1' # Run every Monday at 5:11 PM UTC |
@@ -180,3 +182,44 @@ jobs: |
180 | 182 | }); |
181 | 183 | console.log('Created a new GitHub issue for missing models.'); |
182 | 184 | } |
| 185 | +
|
| 186 | + - name: Close GitHub Issue if all models are up-to-date |
| 187 | + if: steps.check_missing.outputs.needs_update == 'false' |
| 188 | + uses: actions/github-script@v7 |
| 189 | + with: |
| 190 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 191 | + script: | |
| 192 | + const { owner, repo } = context.repo; |
| 193 | +
|
| 194 | + // Find open issues with the specific title and labels |
| 195 | + const { data: issues } = await github.rest.issues.listForRepo({ |
| 196 | + owner, |
| 197 | + repo, |
| 198 | + state: 'open', |
| 199 | + labels: 'maintenance', |
| 200 | + creator: 'github-actions[bot]' |
| 201 | + }); |
| 202 | +
|
| 203 | + const title = '🤖 Action Required: Update Copilot Supported Models'; |
| 204 | + const existingIssue = issues.find(issue => issue.title === title); |
| 205 | +
|
| 206 | + if (existingIssue) { |
| 207 | + // Close the issue with a comment |
| 208 | + await github.rest.issues.createComment({ |
| 209 | + owner, |
| 210 | + repo, |
| 211 | + issue_number: existingIssue.number, |
| 212 | + body: '✅ All Copilot models are now up-to-date. All models from the [GitHub Copilot documentation](https://docs.github.com/en/copilot/reference/ai-models/supported-models) are present in both `tokenEstimators.json` and `modelPricing.json`.\n\nClosing this issue automatically.' |
| 213 | + }); |
| 214 | +
|
| 215 | + await github.rest.issues.update({ |
| 216 | + owner, |
| 217 | + repo, |
| 218 | + issue_number: existingIssue.number, |
| 219 | + state: 'closed' |
| 220 | + }); |
| 221 | +
|
| 222 | + console.log(`Closed issue #${existingIssue.number} as all models are now up-to-date.`); |
| 223 | + } else { |
| 224 | + console.log('No open issue found to close. All models are already up-to-date.'); |
| 225 | + } |
0 commit comments