8
n8n 中文网amn8n.com

临时

中级

这是一个Engineering领域的自动化工作流,包含 11 个节点。主要使用 If, Github, Switch, GithubTrigger 等节点。 通过评论命令自动化GitHub问题分配

前置要求
  • GitHub Personal Access Token

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "lPYVaz2xbN5zFDIL",
  "meta": {
    "instanceId": "cbc68f6c587084f6fe53914a07ed22d475640cb7a6f4ade193e6f0c6d7a06ce8",
    "templateCredsSetupCompleted": true
  },
  "name": "临时",
  "tags": [
    {
      "id": "DaQLpYItTEM2y8Gt",
      "name": "Product",
      "createdAt": "2025-06-17T10:48:17.486Z",
      "updatedAt": "2025-06-17T10:48:17.486Z"
    },
    {
      "id": "6X5c5WbCRWtxJbl2",
      "name": "AI",
      "createdAt": "2025-06-17T10:48:17.367Z",
      "updatedAt": "2025-06-17T10:48:17.367Z"
    },
    {
      "id": "ycHNTMiM8vy98zu1",
      "name": "Building blocks",
      "createdAt": "2025-06-17T10:48:17.563Z",
      "updatedAt": "2025-06-17T10:48:17.563Z"
    },
    {
      "id": "UJ6au0mv063gOupq",
      "name": "Finance",
      "createdAt": "2025-06-17T10:48:17.583Z",
      "updatedAt": "2025-06-17T10:48:17.583Z"
    },
    {
      "id": "CaWiGPzJpyfUHdxp",
      "name": "IT Ops",
      "createdAt": "2025-06-17T10:48:17.388Z",
      "updatedAt": "2025-06-17T10:48:17.388Z"
    },
    {
      "id": "6Uolue5XigSZ2IYx",
      "name": "OpenAI",
      "createdAt": "2025-06-17T10:48:17.508Z",
      "updatedAt": "2025-06-17T10:48:17.508Z"
    },
    {
      "id": "nA8GpDM4XoG5aJ0A",
      "name": "Marketing",
      "createdAt": "2025-06-17T10:48:17.532Z",
      "updatedAt": "2025-06-17T10:48:17.532Z"
    },
    {
      "id": "J4gTJX9lSPm3wByF",
      "name": "Support",
      "createdAt": "2025-06-17T10:48:17.464Z",
      "updatedAt": "2025-06-17T10:48:17.464Z"
    },
    {
      "id": "i294x7TPtUQgJkmv",
      "name": "HR",
      "createdAt": "2025-06-17T10:48:17.426Z",
      "updatedAt": "2025-06-17T10:48:17.426Z"
    }
  ],
  "nodes": [
    {
      "id": "b1e09744-5b20-4336-8760-bdd7422e9b77",
      "name": "切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1100,
        -121
      ],
      "parameters": {
        "rules": {
          "rules": [
            {
              "value2": "opened"
            },
            {
              "output": 1,
              "value2": "created"
            }
          ]
        },
        "value1": "={{$json[\"body\"][\"action\"]}}",
        "dataType": "string"
      },
      "typeVersion": 1
    },
    {
      "id": "d8358b88-60ce-49c8-b156-6e8d29004ac1",
      "name": "如果没有分配人?",
      "type": "n8n-nodes-base.if",
      "position": [
        -880,
        -300
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[\"body\"][\"issue\"][\"assignees\"].length}}",
              "operation": "equal"
            }
          ],
          "string": [
            {
              "value1": "={{$json[\"body\"][\"issue\"][\"body\"]}}",
              "value2": "/[a,A]ssign[\\w*\\s*]*me/gm",
              "operation": "regex"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2cbdec7e-8724-4016-b7b1-eac573946e7f",
      "name": "如果愿意工作?",
      "type": "n8n-nodes-base.if",
      "position": [
        -880,
        100
      ],
      "parameters": {
        "conditions": {
          "number": [],
          "string": [
            {
              "value1": "={{$json[\"body\"][\"comment\"][\"body\"]}}",
              "value2": "/[a,A]ssign[\\w*\\s*]*me/gm",
              "operation": "regex"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "64d80a69-acfd-4e3c-96f2-01706bf2ed48",
      "name": "如果未分配?",
      "type": "n8n-nodes-base.if",
      "position": [
        -660,
        0
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[\"body\"][\"issue\"][\"assignees\"].length}}",
              "operation": "equal"
            }
          ],
          "string": []
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6029b9bd-1616-40c7-ae4b-9d96740151a9",
      "name": "分配给问题创建者",
      "type": "n8n-nodes-base.github",
      "position": [
        -660,
        -400
      ],
      "webhookId": "6d201c22-4f29-49bd-b0fb-2f78756c5403",
      "parameters": {
        "owner": "={{$node[\"Switch\"].json[\"body\"][\"repository\"][\"owner\"][\"login\"]}}",
        "operation": "edit",
        "editFields": {
          "labels": [
            {
              "label": "assigned"
            }
          ],
          "assignees": [
            {
              "assignee": "={{$json.body.issue[\"user\"][\"login\"]}}"
            }
          ]
        },
        "repository": "={{$node[\"Switch\"].json[\"body\"][\"repository\"][\"name\"]}}",
        "issueNumber": "={{ $json[\"body\"][\"issue\"][\"number\"] }}",
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "id": null,
          "name": "GitHub@Harshil"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e3460bc4-fe63-47db-8bbb-c288e2f3f842",
      "name": "添加评论",
      "type": "n8n-nodes-base.github",
      "position": [
        -440,
        100
      ],
      "webhookId": "218f39cf-64fb-41d1-92ba-0849243dee97",
      "parameters": {
        "body": "=Hey @{{$json[\"body\"][\"comment\"][\"user\"][\"login\"]}},\n\nThis issue is already assigned to {{$json[\"body\"][\"issue\"][\"assignee\"][\"login\"]}} 🙂",
        "owner": "={{$json[\"body\"][\"repository\"][\"owner\"][\"login\"]}}",
        "operation": "createComment",
        "repository": "={{$json[\"body\"][\"repository\"][\"name\"]}}",
        "issueNumber": "={{$json[\"body\"][\"issue\"][\"number\"]}}",
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "id": null,
          "name": "GitHub@Harshil"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d65b9db7-8708-4ba3-b95e-c8d2a5b0c6cb",
      "name": "分配给评论者",
      "type": "n8n-nodes-base.github",
      "position": [
        -440,
        -100
      ],
      "webhookId": "3ef2ace6-afe0-47ee-8bb7-3a0a837ce8b7",
      "parameters": {
        "owner": "={{$json[\"body\"][\"repository\"][\"owner\"][\"login\"]}}",
        "operation": "edit",
        "editFields": {
          "labels": [
            {
              "label": "assigned"
            }
          ],
          "assignees": [
            {
              "assignee": "={{$json[\"body\"][\"comment\"][\"user\"][\"login\"]}}"
            }
          ]
        },
        "repository": "={{$json[\"body\"][\"repository\"][\"name\"]}}",
        "issueNumber": "={{$json[\"body\"][\"issue\"][\"number\"]}}",
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "id": null,
          "name": "GitHub@Harshil"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "924d54fc-2744-418a-95f2-d71eb3383f1d",
      "name": "Github触发器1",
      "type": "n8n-nodes-base.githubTrigger",
      "position": [
        -1320,
        -100
      ],
      "webhookId": "52c5fe44-23ef-4903-b6ae-731edd36127e",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "[username]"
        },
        "events": [
          "issue_comment",
          "issues"
        ],
        "options": {},
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "[reponame]"
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "id": null,
          "name": "GitHub Personal Credentials"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "96e8e530-34aa-4e55-a3b6-36fa0f94e7f4",
      "name": "无操作,什么都不做",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -660,
        -200
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "9954a4af-9c03-4761-930d-ee8408b77b8f",
      "name": "无操作,什么都不做1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -660,
        200
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4a8907e2-277f-4985-8dad-5799a4a46e26",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2040,
        -480
      ],
      "parameters": {
        "width": 1820,
        "height": 1000,
        "content": "GitHub自动分配工作流"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "acdd4625-6ad4-4b4d-9e2f-0ed7bed010b4",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "IF no assignee?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IF wants to work?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Github Trigger1": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF no assignee?": {
      "main": [
        [
          {
            "node": "Assign Issue Creator",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF not assigned?": {
      "main": [
        [
          {
            "node": "Assign Commenter",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Add Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF wants to work?": {
      "main": [
        [
          {
            "node": "IF not assigned?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 工程

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流