8
n8n 中文网amn8n.com

AI代理GitHub倦怠检测器

中级

这是一个自动化工作流,包含 13 个节点。主要使用 Set, Code, Github, GmailTool, GithubTool 等节点。 使用Groq AI分析GitHub活动检测团队倦怠,生成健康报告

前置要求
  • GitHub Personal Access Token
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "Th6oymAWb3801GGM",
  "meta": {
    "instanceId": "e93a01df1c52af0d5a5bffda998d2d45d3e65e41e9b02e756e368c852da9b80b"
  },
  "name": "AI 代理 GitHub 倦怠检测器",
  "tags": [
    {
      "id": "Tqphal8U1xgK62Ru",
      "name": "burnout-detector",
      "createdAt": "2025-10-11T15:33:02.359Z",
      "updatedAt": "2025-10-11T15:33:02.359Z"
    },
    {
      "id": "tMPdyC8GBdQzpbC5",
      "name": "team-wellness",
      "createdAt": "2025-10-11T15:49:08.958Z",
      "updatedAt": "2025-10-11T15:49:08.958Z"
    }
  ],
  "nodes": [
    {
      "id": "ce1eaca0-50f9-49de-a865-51c602300439",
      "name": "获取 PR",
      "type": "n8n-nodes-base.github",
      "position": [
        1104,
        -176
      ],
      "webhookId": "1a85b560-3afe-49b9-89be-65f0e0b6922d",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "url",
          "value": "=https://github.com/{{ $('Config').first().json.repoowner }}"
        },
        "resource": "repository",
        "operation": "getPullRequests",
        "returnAll": true,
        "repository": {
          "__rl": true,
          "mode": "url",
          "value": "=https://github.com/{{ $('Config').first().json.repoowner }}/{{  $('Config').first().json.reponame }}"
        },
        "getRepositoryPullRequestsFilters": {
          "state": "all",
          "direction": "desc"
        }
      },
      "credentials": {
        "githubApi": {
          "id": "OWMEIJM53SaS58Kt",
          "name": "GitHub account"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "799820e9-9d39-4300-9c90-31a35c953e1c",
      "name": "配置",
      "type": "n8n-nodes-base.set",
      "position": [
        592,
        -176
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"repoowner\": \"suarifymy\",\n  \"reponame\": \"adk-samples\",\n  \"period\":7,\n  \"emailreport\": \"aiix.space.noreply@gmail.com\"\n}\n"
      },
      "typeVersion": 3.3
    },
    {
      "id": "15e831a2-2321-488f-856a-875c3389f96e",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1520,
        -176
      ],
      "parameters": {
        "text": "= You are a **Professional Team Wellness and Burnout Detection Agent** with strict guardrails.  \nYour role is to analyze developer workload patterns and provide **objective, evidence-based assessments**.  \n\n### Core Rules\n1. NEVER make personal judgments or assumptions about individual developers.  \n2. ONLY analyze observable patterns in code activity data.  \n3. ALWAYS provide evidence-based reasoning for all assessments.  \n4. NEVER suggest disciplinary actions or performance reviews.  \n5. FOCUS on systemic issues and team-level recommendations.  \n6. ALWAYS include confidence scores and data limitations.  \n7. RESPECT privacy and confidentiality of team members.  \n8. PROVIDE actionable, constructive recommendations only.  \n9. AVOID alarmist language—use a professional, measured tone.  \n10. ALWAYS structure responses with clear sections and evidence.  \n\n### Tools Available\n1. **Update GitHub Issue** → Create or update issues for tracking team wellness concerns.  \n2. **Email Tool** → Send urgent notifications to team leads.  \n\n- Use **GitHub Issues** for for CRITICAL alerts (Health Score < 90)\n- Use **Email** ONLY for CRITICAL alerts (Health Score < 90) requiring immediate intervention.  \n\nYour analysis must be **objective, professional, and focused on improving team wellness through positive interventions and follow the report consideration below in a nice md file **. Always update github issues tool.\n\n\noutput report considerations.Please do redaction on any name.\n \noutput html report examples\n```\n# 📊 Team Health Report\n\n\n👩‍💻 Team Activity Snapshot\n📊 Overall Summary\n- Total commits: 6\n- Pull requests opened: 1\n- Workflows run: 1\n- Late‑night commits: 3\n- Weekend commits: 2\n- Failed workflows: 0 ✅\nThe team is keeping activity light this cycle, with a few late‑night pushes and some weekend work showing up.\n\n👥 Developer Activity Breakdown\n- sean\n- Commits: 2\n- Late‑night: 0\n- Weekend: 2 🌙 (notable weekend activity)\n- Ara SAMAD\n- Commits: 3\n- Late‑night: 3 🌙🌙🌙 (all commits after hours)\n- Weekend: 0\n- wzss088\n- Commits: 1\n- Late‑night: 0\n- Weekend: 0\n\n\n\n## 📝 Summary\nOverall, the team is maintaining a healthy delivery pace, but there are emerging signs of workload imbalance due to increased after-hours activity.\n\n---\n\n## 🔢 Health Score\n- **Value:** 68 / 100  \n- **Confidence:** 87%  \n- **Limitations:** Based solely on commit and PR activity; meeting load and non-code tasks not captured.\n\n---\n\n## 🔍 Observed Patterns\n- ⏰ **After-hours activity**  \n  - 29% of commits occurred between 10pm–1am (baseline: 12%).  \n  - Confidence: 0.90  \n\n- 📈 **Weekend workload**  \n  - Weekend commits increased by 35% compared to the previous month.  \n  - Confidence: 0.82  \n\n- 🤝 **Collaboration bottleneck**  \n  - PR review turnaround time increased from 6h → 18h.  \n  - Confidence: 0.78  \n\n---\n\n## ⚠️ Systemic Risks\n- Sustained after-hours work may indicate creeping burnout risk.  \n  - Evidence: 3 consecutive weeks of elevated late-night commits.  \n  - Confidence: 0.85  \n\n- Slower PR reviews may delay feedback loops and increase cycle time.  \n  - Evidence: Median cycle time rose from 2.1 days → 3.4 days.  \n  - Confidence: 0.80  \n\n---\n\n## ✅ Recommendations\n- 📌 Facilitate a team discussion on workload distribution and sprint commitments. *(Priority: Medium)*  \n- 🔔 Introduce automated nudges discouraging late-night commits. *(Priority: Low)*  \n- 🛠️ Rotate PR review responsibilities or adopt lightweight review guidelines. *(Priority: High)*  \n\n--- \n```\nPLease use the tool to send report. You must use html format and follow the html report example above\n\nUser a: {{ JSON.stringify( $('Analyze Patterns Developer').first().json )}}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "ce574d0d-76e2-4c6c-b1ab-850aa544e8cc",
      "name": "Groq 聊天模型报告",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        1376,
        160
      ],
      "parameters": {
        "model": "openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "id": "myslm11JTfGc28Kr",
          "name": "Groq account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "76fd974d-f101-45d0-afcf-4a4ed9c6b3b8",
      "name": "在 Gmail 中发送消息",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        1744,
        160
      ],
      "webhookId": "13fd9a8a-dcd7-4602-9f77-c22edc2dbcab",
      "parameters": {
        "sendTo": "={{  $('Config').first().json.emailreport }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        },
        "subject": " 📊 Team Health and Wellness Report",
        "descriptionType": "manual",
        "toolDescription": "Update reports to stakeholder via email"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "1mQ36iw0MWrsb0cL",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "df7238d2-665d-4da6-aa96-5f430ed04d14",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1872,
        -176
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e71ac601-0698-49f4-a220-e1c3d2fa60ba",
      "name": "分析开发者模式",
      "type": "n8n-nodes-base.code",
      "position": [
        1280,
        -176
      ],
      "parameters": {
        "jsCode": "// Analyze patterns from GitHub data\n\nconst commits =$(\"Github Get Commits\").all();\nconst pullRequests = $('Get Prs').all();\nconst workflows = $(\"Github Get Workflows\").all();\nconst analysisPeriod =$('Config').first().json.period || 7;\n\n// Initialize patterns object\nconst patterns = {\n  total_commits: commits.length,\n  total_prs: pullRequests.length,\n  total_workflows: workflows.length,\n  late_night_commits: 0,\n  weekend_commits: 0,\n  failed_workflows: 0,\n  developer_activity: {}\n};\n\n// Analyze commits\nfor (const commit of commits) {\n  try {\n    const maincommit=commit.json.commit\n    const commitTime = new Date(maincommit.author.date);\n    const hour = commitTime.getHours();\n    const weekday = commitTime.getDay();\n    const author = maincommit.author.name || 'Unknown';\n    \n    // Track late night commits (after 10 PM or before 6 AM)\n    if (hour >= 22 || hour <= 6) {\n      patterns.late_night_commits++;\n    }\n    \n    // Track weekend commits (Saturday = 6, Sunday = 0)\n    if (weekday === 0 || weekday === 6) {\n      patterns.weekend_commits++;\n    }\n    \n    // Track per-developer activity\n    if (!patterns.developer_activity[author]) {\n      patterns.developer_activity[author] = {\n        commits: 0,\n        late_night: 0,\n        weekend: 0\n      };\n    }\n    \n    patterns.developer_activity[author].commits++;\n    if (hour >= 22 || hour <= 6) {\n      patterns.developer_activity[author].late_night++;\n    }\n    if (weekday === 0 || weekday === 6) {\n      patterns.developer_activity[author].weekend++;\n    }\n  } catch (e) {\n    console.log('Error processing commit:', e);\n  }\n}\n\n// Analyze workflows\nfor (const workflow of workflows) {\n  if (workflow.conclusion === 'failure') {\n    patterns.failed_workflows++;\n  }\n}\n\n// Calculate rates\nconst failureRate = (patterns.failed_workflows / Math.max(patterns.total_workflows, 1)) * 100;\nconst lateNightRate = (patterns.late_night_commits / Math.max(patterns.total_commits, 1)) * 100;\nconst weekendRate = (patterns.weekend_commits / Math.max(patterns.total_commits, 1)) * 100;\n\n// Prepare data for AI analysis\nconst analysisData = {\n  repository: $('Config').first().json.reponame  || 'unknown/repo',\n  analysis_period_days: analysisPeriod,\n  patterns: patterns,\n  rates: {\n    failure_rate: failureRate.toFixed(1),\n    late_night_rate: lateNightRate.toFixed(1),\n    weekend_rate: weekendRate.toFixed(1)\n  },\n  raw_data: {\n    // commits: commits,\n    // pull_requests: pullRequests,\n    // workflows: workflows\n  }\n};\n\nreturn [{\n  json: analysisData\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "0ce251fc-69de-4b91-ae36-bf1f92e8ed59",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -256
      ],
      "parameters": {
        "color": 4,
        "width": 1952,
        "height": 624,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3f33cf1e-7011-4a0e-b550-58be70d6ee16",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        -256
      ],
      "parameters": {
        "color": 4,
        "width": 580,
        "height": 624,
        "content": "# 团队健康:AI 倦怠检测代理 [开发者体验]"
      },
      "typeVersion": 1
    },
    {
      "id": "5be57b6b-349f-48a3-aa10-5552799a8ac2",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        352,
        -176
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "daysInterval": 7
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4f6b2323-c3d1-49ce-9a37-616bccf907cc",
      "name": "Github 获取提交",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        944,
        -176
      ],
      "parameters": {
        "url": "=https://api.github.com/repos/{{ $('Config').first().json.repoowner }}/{{  $('Config').first().json.reponame }}/commits",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "created",
              "value": "={{ $now.minus({ days: $json.period || 7 }).toISO() }}..*"
            }
          ]
        },
        "nodeCredentialType": "githubApi"
      },
      "credentials": {
        "githubApi": {
          "id": "OWMEIJM53SaS58Kt",
          "name": "GitHub account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fb1996f6-35dd-4567-89fc-29c77716c57e",
      "name": "Github 获取工作流",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        768,
        -176
      ],
      "parameters": {
        "url": "=https://api.github.com/repos/{{ $json.repoowner}}/{{ $json.reponame}}/actions/runs",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "created",
              "value": "={{ $now.minus({ days: $json.period || 7 }).toISO() }}..*"
            },
            {
              "name": "per_page",
              "value": "50"
            }
          ]
        },
        "nodeCredentialType": "githubApi"
      },
      "credentials": {
        "githubApi": {
          "id": "OWMEIJM53SaS58Kt",
          "name": "GitHub account"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "8deb394b-2654-4202-bff2-08eb40bd87a2",
      "name": "更新 Github 问题",
      "type": "n8n-nodes-base.githubTool",
      "position": [
        1568,
        160
      ],
      "webhookId": "6e6411fe-1caa-4714-95a6-1a61bfd2f006",
      "parameters": {
        "body": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Body', ``, 'string') }}",
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{  $('Config').first().json.repoowner }}"
        },
        "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}",
        "labels": [],
        "assignees": [],
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{  $('Config').first().json.reponame }}"
        },
        "descriptionType": "manual",
        "toolDescription": "#Update Github Issue\nCreate an issue in GitHub on the team wellness"
      },
      "credentials": {
        "githubApi": {
          "id": "OWMEIJM53SaS58Kt",
          "name": "GitHub account"
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "420ee020-9770-4587-ada3-664ab22396b1",
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Github Get Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Prs": {
      "main": [
        [
          {
            "node": "Analyze Patterns Developer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Github Get Commits": {
      "main": [
        [
          {
            "node": "Get Prs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Github Issue": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Github Get Workflows": {
      "main": [
        [
          {
            "node": "Github Get Commits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model Report": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Patterns Developer": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级

需要付费吗?

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

工作流信息
难度等级
中级
节点数量13
分类-
节点类型11
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Sean Lon

Sean Lon

@seanlon

I embarked on my coding journey at the age of 13, driven by a deep passion for AI, automation, and engineering. Over the years, I've taken on various roles including Developer, Engineer, Senior Engineer, Architect, Principal Engineer, Freelance Consultant, and Head of Engineering.

外部链接
在 n8n.io 查看

分享此工作流