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
43 changes: 43 additions & 0 deletions .github/workflows/check-models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
paths:
- .github/workflows/check-models.yml
- .github/scripts/scrape-models.sh
- src/tokenEstimators.json
- src/modelPricing.json

schedule:
- cron: '11 17 * * 1' # Run every Monday at 5:11 PM UTC
Expand Down Expand Up @@ -180,3 +182,44 @@ jobs:
});
console.log('Created a new GitHub issue for missing models.');
}

- name: Close GitHub Issue if all models are up-to-date
if: steps.check_missing.outputs.needs_update == 'false'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;

// Find open issues with the specific title and labels
const { data: issues } = await github.rest.issues.listForRepo({
owner,
repo,
state: 'open',
labels: 'maintenance',
creator: 'github-actions[bot]'
});

const title = 'πŸ€– Action Required: Update Copilot Supported Models';
const existingIssue = issues.find(issue => issue.title === title);

if (existingIssue) {
// Close the issue with a comment
await github.rest.issues.createComment({
owner,
repo,
issue_number: existingIssue.number,
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.'
});

await github.rest.issues.update({
owner,
repo,
issue_number: existingIssue.number,
state: 'closed'
});

console.log(`Closed issue #${existingIssue.number} as all models are now up-to-date.`);
} else {
console.log('No open issue found to close. All models are already up-to-date.');
}
Loading