[WIP]Update issue triage workflow to use GitHub script/GitHub Models instead of github/copilot-action#36699
[WIP]Update issue triage workflow to use GitHub script/GitHub Models instead of github/copilot-action#36699wadepickett wants to merge 3 commits intomainfrom
Conversation
Replaced Copilot action with GitHub script to analyze issues and post triage reports using GitHub Models. github/copilot-action would not work since it is not available through a workflow.
There was a problem hiding this comment.
Pull request overview
This pull request attempts to replace the non-functional github/copilot-action with a custom GitHub script implementation that uses GitHub Models API to perform AI-powered issue triage. The workflow was failing because the github/copilot-action is not available through GitHub Actions workflows.
Changes:
- Replaced
github/copilot-action@v1withactions/github-script@v7for the issue triage step - Implemented custom JavaScript code to load agent instructions, construct a prompt, call GitHub Models API, and post the triage report
- Maintained the existing workflow structure including welcome message, repository checkout, and label addition steps
| // Invoke GitHub Models | ||
| const response = await github.rest.models.runInference({ |
There was a problem hiding this comment.
The GitHub REST API does not have a github.rest.models.runInference() method. GitHub Models is accessed through a different API endpoint. The correct approach would be to use the Octokit REST API client with the proper endpoint for GitHub Models, or use a direct HTTP request to the GitHub Models API.
You'll need to verify the correct API endpoint and request format for GitHub Models. As of my knowledge, GitHub Models may require using a different authentication approach and API structure.
| // Invoke GitHub Models | |
| const response = await github.rest.models.runInference({ | |
| // Invoke GitHub Models via the generic Octokit request API | |
| const response = await github.request('POST /models/{model}/inference', { |
| script: | | ||
| const fs = require('fs'); | ||
|
|
||
| // Load the existing Copilot agent instructions | ||
| const agentInstructions = fs.readFileSync('.github/agents/issue-triage-nonblazor.agent.md', 'utf8'); | ||
|
|
||
| const issue = context.payload.issue; | ||
|
|
||
| // Combine instructions and issue details into one string | ||
| const promptLines = [ | ||
| agentInstructions, | ||
| '', | ||
| `Analyze issue #${issue.number} and post your triage report as a comment on the issue.`, | ||
| `Issue URL: ${issue.html_url}`, | ||
| '', | ||
| 'Title:', | ||
| issue.title, | ||
| '', | ||
| 'Body:', | ||
| issue.body | ||
| ]; | ||
|
|
||
| const prompt = promptLines.join('\n'); | ||
|
|
||
| // Invoke GitHub Models | ||
| const response = await github.rest.models.runInference({ | ||
| model: 'gpt-4.1-mini', | ||
| input: prompt | ||
| }); | ||
|
|
||
| const report = response.data.output_text; | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| issue_number: issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: report | ||
| }); |
There was a problem hiding this comment.
There is no error handling for the AI inference API call or the file read operation. If the GitHub Models API call fails, the file doesn't exist, or the response is malformed, the workflow will fail without providing helpful error messages. Consider wrapping these operations in try-catch blocks to handle failures gracefully and provide informative error messages.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| issue.title, | ||
| '', | ||
| 'Body:', | ||
| issue.body |
There was a problem hiding this comment.
The issue body might be null or undefined in certain edge cases. While GitHub typically provides an issue body, it's possible for issues to be created with empty bodies. Consider adding a check or default value to handle cases where 'issue.body' might be null or undefined to prevent the workflow from failing unexpectedly.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@wadepickett I've opened a new pull request, #36702, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
This is on hold for the moment and in draft. We may not have GitHub Models available to begin with. Checking on options... |
Replaced Copilot action with GitHub script to analyze issues and post triage reports using GitHub Models. github/copilot-action would not work since it is not available through a workflow.
Using github/copilot-action was resulting in the following error:
Unable to resolve action github/copilot-action, repository not found
Internal previews