用 OpenRouter GPT 自动评审 Jira 工单质量并添加辅导评论
Jira 触发 → AI 质量评分 → 低分自动评论
- 给谁
- 使用 Jira Cloud 的团队负责人或项目经理
- 你会得到
- 新 Story/Bug/Task 创建时自动评估质量,低分 ticket 收到辅导式改进建议
- 你需要
- n8n · jira
硬约束
前置条件:n8n 实例、Jira Software Cloud 凭证(邮箱+API token+域名)、OpenRouter API 凭证。默认质量阈值 7/10,默认监控 Story/Bug/Task。默认模型 openai/gpt-oss-20b:free(来源 workflow.json),但模板说明提到 openai/gpt-oss-120b:free(description.md),以 workflow.json 实际配置为准。
他们做了什么
作者 salimbr 在 n8n 上发布了一个工作流模板,当 Jira Cloud 中新建 Story、Bug 或 Task 时,自动调用 OpenRouter 托管的模型评估 ticket 质量,并在质量低于阈值时添加辅导式评论。
效果如何
作者表示该工作流采用辅导语气设计,帮助作者改进而非拒绝工作,使团队易于采纳;合格 ticket 不收到评论,保持 backlog 清洁(author_report)。
值得知道
默认模型 workflow.json 中为 openai/gpt-oss-20b:free,description.md 提到 openai/gpt-oss-120b:free,实际以导入后的节点配置为准。5 项评分标准可根据团队 Definition of Ready 调整。需要 Jira Cloud 管理员权限配置 Webhook。本站未实测该工作流。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- When JIRA Ticket Created 节点:绑定jiraSoftwareCloudApi 凭证。
- Add Comment to JIRA Ticket 节点:绑定jiraSoftwareCloudApi 凭证。
- OpenAI Quality Evaluator 节点:绑定openRouterApi 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #16693(约 13 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-25
步骤
配置触发器与阈值
在 n8n 中导入模板后,配置 Jira Trigger 节点:选择 Jira Software Cloud 凭证,设置事件过滤为 issue_created 且 issuetype in (Story, Bug, Task)。然后配置 Set Score Threshold 节点,将 SCORE_THRESHOLD 设为所需阈值(默认 7)。
配置 AI 质量评估
连接 OpenAI Quality Evaluator(OpenRouter Chat Model)到 Quality Analysis Agent。在 Quality Analysis Agent 中确认提示词:user message 传入 ticket 类型、标题、描述和报告人;system message 定义 5 项评分标准(标题清晰度、描述完整性、验收标准、重现步骤/用户场景、范围与依赖),每项 1-3 分,输出指定 JSON 结构。
运行提示词 · 来源原文。Quality Analysis Agent 节点的 Text / User Message 字段
=Evaluate this Jira ticket: <ticket> Type: {{ $('When JIRA Ticket Created').first().json.issue.fields.issuetype.name }} Title: {{ $('When JIRA Ticket Created').first().json.issue.fields.summary }} Description: {{ $('When JIRA Ticket Created').first().json.issue.fields.description ?? "No description provided." }} Reporter: {{ $('When JIRA Ticket Created').first().json.issue.fields.reporter.displayName }} </ticket> Return the evaluation JSON.运行提示词 · 来源原文。Quality Analysis Agent 节点的 System Message 字段
You are a Jira ticket quality reviewer. Your role is to evaluate whether a ticket contains enough information for a developer to start working on it without asking clarifying questions. Evaluate the ticket on these 5 criteria: 1. **Title clarity** — Is the title specific and action-oriented? (not "Fix bug" or "Update page") 2. **Description completeness** — Does it explain the context, the problem, and the expected behavior? 3. **Acceptance criteria** — Are there clear, testable conditions for "done"? 4. **Reproduction steps** — For bugs: are steps to reproduce present? For stories: is there a user scenario? 5. **Scope & dependencies** — Are unknowns, blockers, or related tickets mentioned? For each criterion, assign a score from 1 to 3: - 1 = Missing or too vague to be useful - 2 = Present but incomplete - 3 = Clear and sufficient Output a JSON object with this exact structure: { "scores": { "title_clarity": 1-3, "description_completeness": 1-3, "acceptance_criteria": 1-3, "reproduction_steps": 1-3, "scope_dependencies": 1-3 }, "total": 5-15, "normalized_score": 1-10, "missing": ["list of the criteria scored 1"], "comment": "2-3 sentence coaching comment addressed directly to the ticket author. Friendly tone. Name exactly what is missing and why it matters. Do not mention the score." } Return only the JSON object. No preamble, no markdown fences.配置分数解析
在 Parse Normalized Score 节点(Code 节点)中保留默认 JS 代码:从 AI 输出中提取 JSON,去除 markdown 代码块标记,解析为对象并返回。若解析失败则抛出错误。
运行提示词 · 来源原文。Parse Normalized Score 节点的 JS Code 字段
const response = $input.first().json.output ?? $input.first().json.text ?? ""; const cleaned = response .replace(/^```json\s*/i, "") .replace(/^```\s*/i, "") .replace(/\s*```$/i, "") .trim(); let scores; try { scores = JSON.parse(cleaned); } catch (error) { throw new Error(`Invalid JSON returned by Quality Checker Agent.\n${error.message}`); } return scores;配置条件分支
在 Check Score Threshold 节点(If 节点)中设置条件:normalized_score < SCORE_THRESHOLD。确保左侧值取自 Parse Normalized Score 的输出,右侧值取自 Set Score Threshold。
配置评论动作
在 Add Comment to JIRA Ticket 节点中配置 Jira 凭证,确认评论模板包含辅导建议、质量分数和缺失项列表。若分数达标,工作流走向 No Action Needed 节点结束。
运行提示词 · 来源原文。Add Comment to JIRA Ticket 节点的 Comment 字段
={{ $json.comment }} **Quality score: {{ $json.normalized_score }}/10** Missing: {{ $json.missing.join(', ') }} _This comment was generated automatically to help keep our backlog clean._
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限
这一段是提示词,页面不会在这里插入广告。
你是一个 n8n 工作流搭建助手。用户想要复现一个 Jira 工单质量自动评审工作流。请协助用户:1)确认已具备 Jira Cloud 和 OpenRouter 凭证;2)从模板 https://n8n.io/workflows/16693/ 导入工作流;3)按步骤检查节点配置,特别是 Quality Analysis Agent 的 system message 和 OpenRouter 模型选择;4)测试时先创建一个低质量 Jira ticket 验证评论是否触发。注意:默认模型为 openai/gpt-oss-20b:free,可根据需要更换。
导入模板后重点检查 Jira 凭证权限、Webhook 可达性,以及 OpenRouter 模型是否支持 JSON 输出。
来源
Review Jira ticket quality with OpenRouter GPT and coaching comments · salimbr · n8n.io · 2026-06-29
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。