-
Notifications
You must be signed in to change notification settings - Fork 0
Add AI agent workflows to auto-comment on issues and PRs #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
74af1db
07cb1a2
4f4c9e9
bb7f155
6d6bc2e
e76d0c8
da577bc
601d024
80c513a
d826b37
4c01769
42eb3ca
08d2974
7b8fb9a
ada719d
4a41d44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| name: Issue Agent | ||
|
|
||
| on: | ||
| issues: | ||
| types: [opened, edited, reopened, labeled] | ||
|
|
||
|
Comment on lines
+3
to
+6
|
||
| permissions: | ||
| issues: write | ||
|
|
||
| jobs: | ||
| analyze-issue: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
|
Comment on lines
+10
to
+13
|
||
| - name: Analyze issue and post comment | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const issueNumber = context.issue.number; | ||
| const issueTitle = context.payload.issue.title; | ||
| const issueBody = context.payload.issue.body || '(no description provided)'; | ||
| const issueUser = context.payload.issue.user.login; | ||
| const labels = (context.payload.issue.labels || []).map(l => l.name).join(', ') || 'none'; | ||
|
|
||
| // Call GitHub Models API for AI-powered analysis | ||
| const response = await fetch('https://models.inference.ai.azure.com/chat/completions', { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'Authorization': `Bearer ${process.env.GITHUB_TOKEN}` | ||
|
Comment on lines
+26
to
+30
|
||
| }, | ||
|
Comment on lines
+26
to
+31
|
||
| body: JSON.stringify({ | ||
| model: 'gpt-4o-mini', | ||
| messages: [ | ||
| { | ||
| role: 'system', | ||
| content: `You are a rigorous technical agent reviewing GitHub issues for the "simulation-theory" repository — a research project on simulation theory, mathematics, quantum mechanics, and philosophy. Your job is to carefully read each issue and provide a thorough, structured analysis. | ||
|
|
||
| For each issue produce: | ||
| 1. **Summary** — a concise one-paragraph summary of what the issue is about. | ||
| 2. **Key Points** — bullet list of the most important observations or questions raised. | ||
| 3. **Relevance to Simulation Theory** — how this issue connects to the project's themes. | ||
| 4. **Suggested Actions** — concrete next steps or questions for the author. | ||
|
|
||
| Be rigorous, thoughtful, and constructive. Keep the tone academic and helpful.` | ||
| }, | ||
| { | ||
| role: 'user', | ||
| content: `Please analyze this GitHub issue:\n\n**Title:** ${issueTitle}\n**Author:** ${issueUser}\n**Labels:** ${labels}\n\n**Description:**\n${issueBody}` | ||
|
Comment on lines
+47
to
+49
|
||
| } | ||
| ], | ||
| max_tokens: 1500, | ||
| temperature: 0.4 | ||
| }) | ||
| }); | ||
|
Comment on lines
+26
to
+55
|
||
|
|
||
| let analysisText; | ||
| if (response.ok) { | ||
| let data; | ||
| try { | ||
| data = await response.json(); | ||
| } catch (error) { | ||
| console.log('Failed to parse JSON from GitHub Models API response:', error); | ||
| } | ||
|
|
||
| if (data && data.choices && data.choices.length > 0 && data.choices[0].message) { | ||
| analysisText = data.choices[0].message.content; | ||
| } else if (data) { | ||
| console.log('Unexpected response structure from GitHub Models API:', JSON.stringify(data)); | ||
| } | ||
| } else { | ||
| console.log(`GitHub Models API returned ${response.status}: ${await response.text()}`); | ||
| } | ||
|
|
||
| // Fallback: structured analysis without AI | ||
| if (!analysisText) { | ||
| analysisText = `**Summary**\nIssue #${issueNumber} titled *"${issueTitle}"* was submitted by @${issueUser}. ${issueBody.length > 0 ? 'It contains a description that may include images or text.' : 'No description was provided.'}\n\n**Labels:** ${labels}\n\n**Suggested Actions**\n- Review the content of this issue and add appropriate labels if missing.\n- Respond to the author with any clarifying questions.\n- Link related issues or pull requests if applicable.`; | ||
|
||
| } | ||
|
|
||
| const marker = '*This comment was generated automatically by the Issue Agent workflow.*'; | ||
| const commentBody = `## 🤖 Agent Analysis\n\n${analysisText}\n\n---\n${marker}`; | ||
|
|
||
| // Look for an existing Issue Agent comment and update it if found to avoid spamming | ||
| const { data: existingComments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: issueNumber, | ||
| per_page: 100 | ||
| }); | ||
|
|
||
| const existingAgentComment = existingComments.find(c => | ||
| c.user && | ||
| c.user.type === 'Bot' && | ||
| typeof c.body === 'string' && | ||
| c.body.includes(marker) | ||
| ); | ||
|
|
||
| if (existingAgentComment) { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: existingAgentComment.id, | ||
| body: commentBody | ||
| }); | ||
| } else { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: issueNumber, | ||
| body: commentBody | ||
| }); | ||
| } | ||
|
Comment on lines
+14
to
+112
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,186 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: PR Agent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request_target: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| types: [opened, reopened] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| models: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| analyze-pr: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+14
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+19
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Collect changed files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: changed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Ensure the base branch ref is available locally (important for fork-based PRs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git fetch origin "${{ github.event.pull_request.base.ref }}" --no-tags --prune --depth=1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BASE="${{ github.event.pull_request.base.sha }}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HEAD="${{ github.event.pull_request.head.sha }}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Compute the list of changed files between base and head; fail explicitly on error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ! ALL_FILES=$(git diff --name-only "$BASE" "$HEAD"); then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Error: failed to compute git diff between $BASE and $HEAD" >&2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Count total changed files robustly, even when there are zero files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TOTAL=$(printf '%s\n' "$ALL_FILES" | sed '/^$/d' | wc -l | tr -d ' ') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FILES=$(echo "$ALL_FILES" | head -50 | tr '\n' ', ') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
blackboxprogramming marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FILES="${FILES%, }" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$TOTAL" -gt 50 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| REMAINING=$(( TOTAL - 50 )) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FILES="${FILES} (and ${REMAINING} more files)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo 'files<<EOF' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "$FILES" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo 'EOF' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+49
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Collect changed files | |
| id: changed | |
| run: | | |
| # Ensure the base branch ref is available locally (important for fork-based PRs) | |
| git fetch origin "${{ github.event.pull_request.base.ref }}" --no-tags --prune --depth=1 | |
| BASE="${{ github.event.pull_request.base.sha }}" | |
| HEAD="${{ github.event.pull_request.head.sha }}" | |
| # Compute the list of changed files between base and head; fail explicitly on error | |
| if ! ALL_FILES=$(git diff --name-only "$BASE" "$HEAD"); then | |
| echo "Error: failed to compute git diff between $BASE and $HEAD" >&2 | |
| exit 1 | |
| fi | |
| # Count total changed files robustly, even when there are zero files | |
| TOTAL=$(printf '%s\n' "$ALL_FILES" | sed '/^$/d' | wc -l | tr -d ' ') | |
| FILES=$(echo "$ALL_FILES" | head -50 | tr '\n' ', ') | |
| FILES="${FILES%, }" | |
| if [ "$TOTAL" -gt 50 ]; then | |
| REMAINING=$(( TOTAL - 50 )) | |
| FILES="${FILES} (and ${REMAINING} more files)" | |
| fi | |
| { | |
| echo 'files<<EOF' | |
| echo "$FILES" | |
| echo 'EOF' | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Collect changed files | |
| id: changed | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| result-encoding: string | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const perPage = 100; | |
| let page = 1; | |
| const files = []; | |
| while (true) { | |
| const { data } = await github.rest.pulls.listFiles({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber, | |
| per_page: perPage, | |
| page, | |
| }); | |
| if (!data.length) { | |
| break; | |
| } | |
| for (const file of data) { | |
| files.push(file.filename); | |
| } | |
| if (data.length < perPage) { | |
| break; | |
| } | |
| page += 1; | |
| } | |
| const total = files.length; | |
| const limited = files.slice(0, 50); | |
| let summary = limited.join(', '); | |
| if (total > 50) { | |
| const remaining = total - 50; | |
| summary += ` (and ${remaining} more files)`; | |
| } | |
| core.setOutput('files', summary); |
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User-provided content (PR title, description, branch names) is directly interpolated into the AI prompt without sanitization. While the content is only sent to the GitHub Models API and not rendered directly in the comment, this could still lead to prompt injection attacks where malicious users craft PR content designed to manipulate the AI's response.
Consider:
- Adding a content length limit before sending to the API (especially for PR body which can be very long)
- Sanitizing or escaping special characters that could be used for prompt injection
- Adding a disclaimer in the workflow documentation about the risks of AI-generated content
Note: This is partially mitigated by the fact that the AI's response is wrapped in a clearly marked bot comment, but prompt injection could still cause the bot to generate misleading or inappropriate analysis.
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With active PRs mentioned in the description, triggering this workflow on 'opened', 'edited', 'synchronize', and 'reopened' events could result in significant API usage costs. Each workflow run makes an API call to the GitHub Models service with max_tokens set to 1500. The 'synchronize' event in particular fires on every new commit, which could lead to many API calls for actively developed PRs. Consider implementing rate limiting, cooldown periods, or restricting which events trigger the workflow to control costs and avoid hitting potential API rate limits.
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code block detected. Lines 106-120 duplicate the logic from lines 102-120, creating a nested try-catch structure that will never work correctly. The outer try block (starting at line 104) is opened but never closed, and the inner try block (starting at line 107) creates duplicate logic. This will cause the workflow to fail with a syntax error when executed. The duplicate try-catch block starting at line 107 should be removed entirely.
| try { | |
| if (response.ok) { | |
| const data = await response.json(); | |
| if (data.choices && data.choices.length > 0 && data.choices[0].message) { | |
| analysisText = data.choices[0].message.content; | |
| } else { | |
| console.log('Unexpected response structure from GitHub Models API:', JSON.stringify(data)); | |
| } | |
| } else { | |
| console.log(`GitHub Models API returned ${response.status}: ${await response.text()}`); | |
| } | |
| } catch (error) { | |
| console.log('Error while calling or parsing response from GitHub Models API, falling back to templated analysis:', error); | |
| analysisText = data.choices[0].message.content; | |
| } else { | |
| console.log('Unexpected response structure from GitHub Models API:', JSON.stringify(data)); | |
| } | |
| } catch (error) { | |
| console.log('Error while calling or parsing response from GitHub Models API, falling back to templated analysis:', error); | |
| } | |
| } else { | |
| console.log(`GitHub Models API returned ${response.status}: ${await response.text()}`); |
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing closing brace for the try block that starts at line 104. The code has a try statement at line 104 but no corresponding closing brace, which will cause a JavaScript syntax error when the workflow runs. After the duplicate code block is removed, ensure there's a proper closing brace for the try block and a corresponding catch block to handle any exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow will post a new comment every time it's triggered, which could lead to spam on issues that are edited multiple times. For the
editedtrigger, consider either:editedtrigger if re-analysis on edits isn't necessaryThe same pattern applies to issues that are repeatedly labeled/unlabeled.