8
n8n 中文网amn8n.com

自动化错误报告:GitHub Issues → AI分析 → Jira工单,附带Slack和Discord提醒

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 22 个节点。主要使用 If, Code, Jira, Slack, Github 等节点。 GitHub到Jira错误同步,含GPT-4o分析与团队提醒

前置要求
  • Slack Bot Token 或 Webhook URL
  • GitHub Personal Access Token
  • Discord Bot Token 或 Webhook
  • HTTP Webhook 端点(n8n 会自动生成)
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "name": "自动化错误报告:GitHub Issues → AI分析 → Jira工单,附带Slack和Discord提醒",
  "tags": [],
  "nodes": [
    {
      "id": "sticky-overview",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        250,
        300
      ],
      "parameters": {
        "width": 400,
        "height": 380,
        "content": "## 🔄 自动化错误工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-webhook",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        250,
        750
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "## 📥 步骤1:WEBHOOK"
      },
      "typeVersion": 1
    },
    {
      "id": "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d",
      "name": "GitHub Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        400,
        1100
      ],
      "webhookId": "",
      "parameters": {
        "path": "github-issue-webhook",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-filter",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        750
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "## 🔍 步骤2:过滤器"
      },
      "typeVersion": 1
    },
    {
      "id": "b2c3d4e5-f6a7-4b5c-9d0e-1f2a3b4c5d6e",
      "name": "过滤器:仅新问题",
      "type": "n8n-nodes-base.if",
      "position": [
        750,
        1100
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json.action}}",
              "value2": "opened",
              "operation": "equals"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-extract",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        950,
        750
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "## 📋 步骤3:提取数据"
      },
      "typeVersion": 1
    },
    {
      "id": "c3d4e5f6-a7b8-4c5d-0e1f-2a3b4c5d6e7f",
      "name": "提取问题上下文",
      "type": "n8n-nodes-base.code",
      "position": [
        1100,
        1100
      ],
      "parameters": {
        "jsCode": "const issue = $input.item.json.issue;\nconst repo = $input.item.json.repository;\n\nconst fileRegex = /`([^`]*\\.(js|py|ts|jsx|tsx|java|go|rb|php|cpp|c|css|html))`/g;\nconst mentionedFiles = [];\nlet match;\n\nif (issue.body) {\n  while ((match = fileRegex.exec(issue.body)) !== null) {\n    mentionedFiles.push(match[1]);\n  }\n}\n\nreturn {\n  issueNumber: issue.number,\n  title: issue.title,\n  description: issue.body || \"No description provided\",\n  reporter: issue.user.login,\n  reporterAvatar: issue.user.avatar_url,\n  labels: issue.labels.map(l => l.name).join(\", \") || \"none\",\n  url: issue.html_url,\n  createdAt: issue.created_at,\n  mentionedFiles: mentionedFiles.join(\", \") || \"No files mentioned\",\n  repositoryName: repo.full_name,\n  repositoryOwner: repo.owner.login,\n  repositoryRepo: repo.name\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "sticky-ai",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        750
      ],
      "parameters": {
        "width": 280,
        "height": 340,
        "content": "## 🤖 步骤4:AI分析"
      },
      "typeVersion": 1
    },
    {
      "id": "d4e5f6a7-b8c9-4d5e-1f2a-3b4c5d6e7f8a",
      "name": "GPT-4o错误分析",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1450,
        1100
      ],
      "parameters": {
        "text": "=Analyze this GitHub issue and provide a structured response in valid JSON format:\n\n**Issue Title:** {{$json.title}}\n**Description:** {{$json.description}}\n**Labels:** {{$json.labels}}\n**Mentioned Files:** {{$json.mentionedFiles}}\n**Repository:** {{$json.repositoryName}}\n\nProvide your analysis in this exact JSON structure:\n{\n  \"bugSeverity\": \"Critical|High|Medium|Low\",\n  \"category\": \"Backend|Frontend|Database|API|UI|Performance|Security|Infrastructure\",\n  \"reproductionSteps\": \"Clear numbered steps to reproduce\",\n  \"potentialRootCause\": \"Brief technical analysis\",\n  \"suggestedPriority\": \"P0|P1|P2|P3\",\n  \"estimatedComplexity\": \"Simple|Medium|Complex\",\n  \"recommendedDeveloper\": \"backend-dev|frontend-dev|fullstack-dev|devops\",\n  \"estimatedHours\": \"number between 1-40\"\n}\n\nRespond with ONLY the JSON object, no additional text.",
        "model": "gpt-4o",
        "options": {
          "maxTokens": 1000,
          "temperature": 0.3
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "sticky-parse",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1650,
        750
      ],
      "parameters": {
        "width": 300,
        "height": 340,
        "content": "## 🔧 步骤5:解析和映射"
      },
      "typeVersion": 1
    },
    {
      "id": "e5f6a7b8-c9d0-4e5f-2a3b-4c5d6e7f8a9b",
      "name": "解析GPT响应和映射数据",
      "type": "n8n-nodes-base.code",
      "position": [
        1800,
        1100
      ],
      "parameters": {
        "jsCode": "const issueData = $('Extract Issue Context').item.json;\nconst gptResponse = $input.item.json.text;\n\nlet analysis;\ntry {\n  analysis = JSON.parse(gptResponse);\n} catch (error) {\n  analysis = {\n    bugSeverity: \"Medium\",\n    category: \"General\",\n    reproductionSteps: \"See original issue\",\n    potentialRootCause: \"Requires investigation\",\n    suggestedPriority: \"P2\",\n    estimatedComplexity: \"Medium\",\n    recommendedDeveloper: \"fullstack-dev\",\n    estimatedHours: 8\n  };\n}\n\nconst developerMapping = {\n  \"backend-dev\": \"backend.dev@company.com\",\n  \"frontend-dev\": \"frontend.dev@company.com\",\n  \"fullstack-dev\": \"fullstack.dev@company.com\",\n  \"devops\": \"devops@company.com\"\n};\n\nconst priorityMapping = {\n  \"P0\": \"Highest\",\n  \"P1\": \"High\",\n  \"P2\": \"Medium\",\n  \"P3\": \"Low\"\n};\n\nreturn {\n  ...issueData,\n  bugSeverity: analysis.bugSeverity,\n  category: analysis.category,\n  reproductionSteps: analysis.reproductionSteps,\n  potentialRootCause: analysis.potentialRootCause,\n  suggestedPriority: analysis.suggestedPriority,\n  estimatedComplexity: analysis.estimatedComplexity,\n  estimatedHours: analysis.estimatedHours,\n  recommendedDeveloper: analysis.recommendedDeveloper,\n  assignedDeveloper: developerMapping[analysis.recommendedDeveloper] || \"triage@company.com\",\n  jiraLabels: [analysis.category, analysis.bugSeverity],\n  jiraPriority: priorityMapping[analysis.suggestedPriority] || \"Medium\"\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "sticky-jira",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        750
      ],
      "parameters": {
        "width": 300,
        "height": 340,
        "content": "## 🎫 步骤6:创建JIRA"
      },
      "typeVersion": 1
    },
    {
      "id": "f6a7b8c9-d0e1-4f5a-3b4c-5d6e7f8a9b0c",
      "name": "创建Jira工单",
      "type": "n8n-nodes-base.jira",
      "position": [
        2150,
        1100
      ],
      "parameters": {
        "project": "YOUR_JIRA_PROJECT_KEY",
        "summary": "=[GitHub #{{$json.issueNumber}}] {{$json.title}}",
        "resource": "issue",
        "issueType": "Bug",
        "operation": "create",
        "description": "=*报告者:* {{$json.reporter}}",
        "additionalFields": {
          "labels": "={{$json.jiraLabels}}",
          "assignee": "={{$json.assignedDeveloper}}",
          "priority": "={{$json.jiraPriority}}"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-notify",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2350,
        750
      ],
      "parameters": {
        "width": 360,
        "height": 340,
        "content": "## 🔔 步骤7:通知"
      },
      "typeVersion": 1
    },
    {
      "id": "a7b8c9d0-e1f2-4a5b-4c5d-6e7f8a9b0c1d",
      "name": "更新GitHub问题",
      "type": "n8n-nodes-base.github",
      "position": [
        2550,
        950
      ],
      "parameters": {
        "body": "=🤖 **Automated Bug Report Created**\n\n📋 **Jira Ticket:** [{{$json.key}}](https://your-company.atlassian.net/browse/{{$json.key}})\n\n**AI Analysis:**\n- **Severity:** {{$('Parse GPT Response & Map Data').item.json.bugSeverity}}\n- **Category:** {{$('Parse GPT Response & Map Data').item.json.category}}\n- **Priority:** {{$('Parse GPT Response & Map Data').item.json.suggestedPriority}}\n- **Assigned to:** {{$('Parse GPT Response & Map Data').item.json.assignedDeveloper}}\n- **Estimated Time:** {{$('Parse GPT Response & Map Data').item.json.estimatedHours}} hours\n\nThis issue has been automatically triaged and assigned. A developer will review soon.",
        "owner": "={{$('Parse GPT Response & Map Data').item.json.repositoryOwner}}",
        "resource": "issue",
        "operation": "createComment",
        "repository": "={{$('Parse GPT Response & Map Data').item.json.repositoryRepo}}",
        "issueNumber": "={{$('Parse GPT Response & Map Data').item.json.issueNumber}}",
        "authentication": "oAuth2"
      },
      "typeVersion": 1
    },
    {
      "id": "b8c9d0e1-f2a3-4b5c-5d6e-7f8a9b0c1d2e",
      "name": "发送Slack警报",
      "type": "n8n-nodes-base.slack",
      "position": [
        2550,
        1100
      ],
      "parameters": {
        "text": "=New Bug Report",
        "channel": "dev-alerts",
        "blocksUi": {
          "blocksValues": [
            {
              "type": "header",
              "textUi": {
                "text": "=🐛 New Bug: GitHub #{{$('Extract Issue Context').item.json.issueNumber}}"
              }
            },
            {
              "type": "section",
              "fieldsUi": {
                "fieldsValues": [
                  {
                    "text": "=*Title:*\\n{{$('Extract Issue Context').item.json.title}}"
                  },
                  {
                    "text": "=*Severity:*\\n{{$('Parse GPT Response & Map Data').item.json.bugSeverity}}"
                  },
                  {
                    "text": "=*Category:*\\n{{$('Parse GPT Response & Map Data').item.json.category}}"
                  },
                  {
                    "text": "=*Priority:*\\n{{$('Parse GPT Response & Map Data').item.json.suggestedPriority}}"
                  },
                  {
                    "text": "=*Assigned:*\\n{{$('Parse GPT Response & Map Data').item.json.assignedDeveloper}}"
                  },
                  {
                    "text": "=*Est. Hours:*\\n{{$('Parse GPT Response & Map Data').item.json.estimatedHours}}h"
                  }
                ]
              }
            },
            {
              "type": "section",
              "textUi": {
                "text": "=*Potential Cause:*\\n{{$('Parse GPT Response & Map Data').item.json.potentialRootCause}}"
              }
            },
            {
              "type": "actions",
              "elementsUi": {
                "elementsValues": [
                  {
                    "url": "={{$('Extract Issue Context').item.json.url}}",
                    "type": "button",
                    "textUi": {
                      "text": "View in GitHub"
                    }
                  },
                  {
                    "url": "=https://your-company.atlassian.net/browse/{{$json.key}}",
                    "type": "button",
                    "textUi": {
                      "text": "View in Jira"
                    }
                  }
                ]
              }
            }
          ]
        },
        "resource": "message",
        "operation": "post"
      },
      "typeVersion": 2.1
    },
    {
      "id": "c9d0e1f2-a3b4-4c5d-6e7f-8a9b0c1d2e3f",
      "name": "发送Discord提醒",
      "type": "n8n-nodes-base.discord",
      "position": [
        2550,
        1250
      ],
      "parameters": {
        "url": "YOUR_DISCORD_WEBHOOK_URL",
        "content": "=🐛 **New Bug Report - {{$('Parse GPT Response & Map Data').item.json.bugSeverity}} Priority**\\n\\n**GitHub Issue:** #{{$('Extract Issue Context').item.json.issueNumber}} - {{$('Extract Issue Context').item.json.title}}\\n**Jira Ticket:** {{$json.key}}\\n**Severity:** {{$('Parse GPT Response & Map Data').item.json.bugSeverity}}\\n**Category:** {{$('Parse GPT Response & Map Data').item.json.category}}\\n**Assigned:** {{$('Parse GPT Response & Map Data').item.json.assignedDeveloper}}\\n**Estimated:** {{$('Parse GPT Response & Map Data').item.json.estimatedHours}} hours\\n\\n**Potential Cause:**\\n{{$('Parse GPT Response & Map Data').item.json.potentialRootCause}}\\n\\n🔗 [GitHub]({{$('Extract Issue Context').item.json.url}}) | [Jira](https://your-company.atlassian.net/browse/{{$json.key}})",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "sticky-response",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2750,
        750
      ],
      "parameters": {
        "width": 300,
        "height": 340,
        "content": "## ✅ 步骤8:响应"
      },
      "typeVersion": 1
    },
    {
      "id": "d0e1f2a3-b4c5-4d5e-7f8a-9b0c1d2e3f4a",
      "name": "Webhook响应",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2900,
        1100
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"success\", \"message\": \"Bug report processed\", \"jiraTicket\": $json.key } }}"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-troubleshoot",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        250,
        1450
      ],
      "parameters": {
        "width": 420,
        "height": 540,
        "content": "# 🔧 故障排除"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-roi",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        710,
        1450
      ],
      "parameters": {
        "width": 420,
        "height": 540,
        "content": "# 📊 投资回报率计算器"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-customize",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1170,
        1450
      ],
      "parameters": {
        "width": 420,
        "height": 540,
        "content": "# 🎨 自定义想法"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "GitHub Webhook": {
      "main": [
        [
          {
            "node": "Filter: Only New Issues",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Jira Ticket": {
      "main": [
        [
          {
            "node": "Update GitHub Issue",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Slack Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Discord Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o Bug Analysis": {
      "main": [
        [
          {
            "node": "Parse GPT Response & Map Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update GitHub Issue": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Issue Context": {
      "main": [
        [
          {
            "node": "GPT-4o Bug Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: Only New Issues": {
      "main": [
        [
          {
            "node": "Extract Issue Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse GPT Response & Map Data": {
      "main": [
        [
          {
            "node": "Create Jira Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量22
分类2
节点类型10
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Shelly-Ann Davy

Shelly-Ann Davy

@SheCodesFlow

Founder of The Workflow Muse & @SheCodesFlow. I craft elegant, task-focused automations for creators, founders, and soft-tech enthusiasts. “Automate with grace. Scale with power.”

外部链接
在 n8n.io 查看

分享此工作流