文档同步工作流

高级

这是一个自动化工作流,包含 16 个节点。主要使用 If、Slack、Github、GithubTrigger、Agent 等节点。 自动文档同步:GitHub到Slack,含GPT-4o Mini摘要

前置要求
  • Slack Bot Token 或 Webhook URL
  • GitHub Personal Access Token
  • OpenAI API Key

分类

未分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "x0albhzs79R3Tmfm",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "文档同步工作流",
  "tags": [],
  "nodes": [
    {
      "id": "e6f72597-24f7-46f9-bf57-df361d91d2c0",
      "name": "监听 PR 事件",
      "type": "n8n-nodes-base.githubTrigger",
      "position": [
        -2064,
        176
      ],
      "webhookId": "262ba0f4-0671-4950-9ce2-e5316717edab",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "url",
          "value": "https://github.com/anuj658/n8n-project/tree/anuj"
        },
        "events": [
          "pull_request"
        ],
        "options": {},
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "n8n-project",
          "cachedResultUrl": "https://github.com/anuj658/n8n-project",
          "cachedResultName": "n8n-project"
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "id": "xqrQrEJwugKxUIab",
          "name": "GitHub account-anuj"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "155ef9cd-fe67-4af8-90b7-8cd33ab904af",
      "name": "📋 工作流概览",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2384,
        80
      ],
      "parameters": {
        "width": 250,
        "height": 300,
        "content": "🚀 工作流启动"
      },
      "typeVersion": 1
    },
    {
      "id": "17016417-98fe-437d-bc8a-0dc47f78f737",
      "name": "PR 是否合并到主分支?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1840,
        176
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"body\"][\"pull_request\"][\"base\"][\"ref\"]}}",
              "value2": "main",
              "operation": "contains"
            },
            {
              "value1": "={{$json[\"body\"][\"pull_request\"][\"merged\"]}}",
              "value2": "false"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "58d77011-30ef-4083-8039-8ad7c19b400f",
      "name": "🔍 验证门",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1952,
        352
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "✅ 验证门"
      },
      "typeVersion": 1
    },
    {
      "id": "ecd617ef-c912-463c-b33f-a5d4754465ef",
      "name": "获取 README 内容",
      "type": "n8n-nodes-base.github",
      "position": [
        -1616,
        176
      ],
      "webhookId": "51b734f8-e1cd-4bd0-8996-6b8e38f1cee0",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "url",
          "value": "https://github.com/anuj658/n8n-project"
        },
        "filePath": "README.md",
        "resource": "file",
        "operation": "get",
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "n8n-project",
          "cachedResultUrl": "https://github.com/anuj658/n8n-project",
          "cachedResultName": "n8n-project"
        },
        "authentication": "oAuth2",
        "additionalParameters": {}
      },
      "credentials": {
        "githubOAuth2Api": {
          "id": "xqrQrEJwugKxUIab",
          "name": "GitHub account-anuj"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "cf09bbcd-f959-4ae1-8c1e-7c902072910f",
      "name": "📥 文件检索",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1712,
        -128
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "📥 GITHUB 文件检索"
      },
      "typeVersion": 1
    },
    {
      "id": "456cf796-a361-4d82-afea-9bc66fe7f429",
      "name": "文档是否被修改?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1392,
        176
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{JSON.stringify($json)}}",
              "value2": "docs",
              "operation": "contains"
            },
            {
              "value1": "={{JSON.stringify($json)}}",
              "value2": "README",
              "operation": "contains"
            },
            {
              "value1": "={{JSON.stringify($json)}}",
              "value2": "openapi",
              "operation": "contains"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1f990ead-3f32-48c7-bbd7-a9cf5b9af9f9",
      "name": "🔎 文档检测",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        352
      ],
      "parameters": {
        "width": 280,
        "height": 320,
        "content": "🔎 文档检测"
      },
      "typeVersion": 1
    },
    {
      "id": "622f0344-42a4-477c-ae9a-0a7c5b4c7355",
      "name": "AI 摘要代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1168,
        -80
      ],
      "parameters": {
        "text": "Summarize the changes in the documentation briefly in 2-3 sentences.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "2c845de1-a35c-4f32-b112-74fb4e677880",
      "name": "🤖 AI 代理",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -384
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "🤖 AI 摘要"
      },
      "typeVersion": 1
    },
    {
      "id": "41f13861-a2bf-4c35-b1ea-82f2e275768f",
      "name": "Azure OpenAI 模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -864,
        240
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "C3WzT18XqF8OdVM6",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f7559c04-28b2-4e3c-bb7d-06436e8524fd",
      "name": "⚙️ LLM 配置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -736,
        208
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "⚙️ LLM 配置"
      },
      "typeVersion": 1
    },
    {
      "id": "9f005c0f-1416-4166-9d83-a26b658f0b84",
      "name": "提醒文档团队 (Slack)",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1056,
        320
      ],
      "parameters": {
        "text": "📢 *Docs Auto-Synced!*\n📦 Repo: {{$json[\"body\"][\"repository\"][\"full_name\"]}}\n🌿 Branch: {{$json[\"body\"][\"pull_request\"][\"base\"][\"ref\"]}}\n👤 Author: {{$json[\"body\"][\"pull_request\"][\"user\"][\"login\"]}}\n📝 Title: {{$json[\"body\"][\"pull_request\"][\"title\"]}}\n🔗 PR: {{$json[\"body\"][\"pull_request\"][\"html_url\"]}}",
        "channel": "#documentation-updates",
        "attachments": [],
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": null,
          "name": "Slack Token"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "205d8659-f97b-4310-ac09-0174da664684",
      "name": "📢 Slack 提醒",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        512
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "📢 SLACK 通知"
      },
      "typeVersion": 1
    },
    {
      "id": "8e8c820c-ad01-40e9-b269-e1fa4f1ffc4f",
      "name": "将 AI 摘要发布到 Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -816,
        16
      ],
      "webhookId": "3bd11cca-5947-4933-ab7d-9bdaadb693b5",
      "parameters": {
        "text": "🔔 Documentation changes detected:\n{{$json}}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09GNB90TED",
          "cachedResultName": "general-information"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "31816220-f24d-47b2-ae2f-737e1157ed0e",
      "name": "📤 摘要发布",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -272
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "📤 AI 摘要到 SLACK"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "bc63ac13-fb64-4148-99ea-e6e60d9c6d96",
  "connections": {
    "Are Docs Modified?": {
      "main": [
        [
          {
            "node": "AI Summarizer Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Alert Docs Team (Slack)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Summarizer Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Summarizer Agent": {
      "main": [
        [
          {
            "node": "Post AI Summary to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch README Content": {
      "main": [
        [
          {
            "node": "Are Docs Modified?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Listen for PR Events": {
      "main": [
        [
          {
            "node": "Is PR Merged to Main?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is PR Merged to Main?": {
      "main": [
        [
          {
            "node": "Fetch README Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的通用自动化工作流。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

工作流信息
难度等级
高级
节点数量16
分类-
节点类型7
难度说明

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

作者
Rahul Joshi

Rahul Joshi

@rahul08

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

外部链接
在 n8n.io 上查看 →

分享此工作流