Skip to content

Commit 68611d8

Browse files
akoclaude
andcommitted
feat: add AI issue triage workflow
Automatically reviews new issues for completeness. Checks bug reports for mxcli version, Mendix version, scenario, expected/experienced output, and diag bundle. Checks feature requests for use case and proposed syntax. Uses OpenRouter free tier (same as PR review). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d322ca4 commit 68611d8

1 file changed

Lines changed: 127 additions & 0 deletions

File tree

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: AI Issue Review
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
review:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Get issue details
15+
env:
16+
GH_TOKEN: ${{ github.token }}
17+
run: |
18+
gh issue view ${{ github.event.issue.number }} \
19+
--repo ${{ github.repository }} \
20+
--json title,body,labels > /tmp/issue.json
21+
22+
- name: Build API request
23+
run: |
24+
cat > /tmp/user-prompt.txt <<PROMPT
25+
Review this GitHub issue for completeness.
26+
27+
Issue:
28+
$(cat /tmp/issue.json)
29+
30+
Check whether the issue includes the following required information.
31+
Not all fields apply to every issue type — use judgement.
32+
33+
For **bug reports**, require:
34+
1. mxcli version (output of mxcli --version or commit/build info)
35+
2. Mendix version (e.g. 10.x, 9.x) of the project being processed
36+
3. Scenario — what the user was trying to do (MDL script, CLI command, etc.)
37+
4. Expected output — what should have happened
38+
5. Experienced output — what actually happened (error message, wrong result, crash)
39+
6. AI bug report — output of mxcli diag --bundle or at minimum the session log
40+
41+
For **feature requests**, require:
42+
1. Use case — why the feature is needed, what problem it solves
43+
2. Proposed syntax or behavior (if applicable)
44+
3. Mendix version relevance (if version-specific)
45+
46+
Respond with:
47+
- A short summary of what the issue is about (1 sentence)
48+
- A checklist showing which required fields are present or missing
49+
- If anything is missing, a polite comment asking the reporter to add it
50+
- If the issue looks complete, say so and thank the reporter
51+
52+
Keep the tone friendly and constructive. Do not repeat the issue body back.
53+
PROMPT
54+
55+
jq -n --rawfile prompt /tmp/user-prompt.txt '{
56+
model: "nvidia/nemotron-3-super-120b-a12b:free",
57+
messages: [
58+
{
59+
role: "system",
60+
content: "You are a triage assistant for mxcli, a Go CLI tool that reads and modifies Mendix application projects (.mpr files). Your job is to review new bug reports and feature requests for completeness. Be helpful and welcoming. If information is missing, ask for it politely. Keep your response concise."
61+
},
62+
{
63+
role: "user",
64+
content: $prompt
65+
}
66+
],
67+
max_tokens: 2000,
68+
temperature: 0.3
69+
}' > /tmp/request.json
70+
71+
echo "Request payload size: $(wc -c < /tmp/request.json) bytes"
72+
73+
- name: Call OpenRouter API
74+
env:
75+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
76+
run: |
77+
if [ -z "$OPENROUTER_API_KEY" ]; then
78+
echo "::warning::OPENROUTER_API_KEY secret is not set"
79+
exit 0
80+
fi
81+
82+
HTTP_CODE=$(curl -s -w "%{http_code}" -o /tmp/response.json -X POST \
83+
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
84+
-H "Content-Type: application/json" \
85+
-d @/tmp/request.json \
86+
https://openrouter.ai/api/v1/chat/completions)
87+
88+
echo "HTTP status: $HTTP_CODE"
89+
90+
if [ "$HTTP_CODE" != "200" ]; then
91+
echo "::warning::OpenRouter API returned HTTP $HTTP_CODE"
92+
cat /tmp/response.json | head -c 1000
93+
exit 0
94+
fi
95+
96+
REVIEW=$(jq -r '.choices[0].message.content // empty' /tmp/response.json)
97+
98+
if [ -z "$REVIEW" ]; then
99+
echo "::warning::AI review returned empty content. Response:"
100+
cat /tmp/response.json | head -c 1000
101+
exit 0
102+
fi
103+
104+
echo "$REVIEW" > /tmp/review.txt
105+
echo "Review generated ($(wc -c < /tmp/review.txt) bytes)"
106+
107+
- name: Post review comment
108+
env:
109+
GH_TOKEN: ${{ github.token }}
110+
run: |
111+
if [ ! -f /tmp/review.txt ]; then
112+
echo "No review to post."
113+
exit 0
114+
fi
115+
116+
{
117+
echo "## Issue Triage"
118+
echo ""
119+
cat /tmp/review.txt
120+
echo ""
121+
echo "---"
122+
echo "*Automated triage via OpenRouter — [workflow source](${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/ai-issue-review.yml)*"
123+
} > /tmp/comment.md
124+
125+
gh issue comment ${{ github.event.issue.number }} \
126+
--repo ${{ github.repository }} \
127+
--body-file /tmp/comment.md

0 commit comments

Comments
 (0)