8
n8n 中文网amn8n.com

Notion-GitHub 自动化流程

中级

这是一个Project Management领域的自动化工作流,包含 14 个节点。主要使用 Set, Gmail, Github, Notion, Switch 等节点。 从 Notion 到 GitHub 的自动化流程,包含邮件通知

前置要求
  • Google 账号和 Gmail API 凭证
  • GitHub Personal Access Token
  • Notion API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "MkdncnBkezX9QPQZ",
  "meta": {
    "instanceId": "43fe624f1392ada2f15246a2a3a9f0bf4079ffe6ba53194387a75aad0085752f",
    "templateCredsSetupCompleted": true
  },
  "name": "notion-github",
  "tags": [
    {
      "id": "7w2Ku9VPbcMLEYjA",
      "name": "from6",
      "createdAt": "2025-07-02T10:28:35.419Z",
      "updatedAt": "2025-07-02T10:28:35.419Z"
    }
  ],
  "nodes": [
    {
      "id": "7c3adcf2-0f6c-4b9f-840c-9f1f1ad7b6fc",
      "name": "获取多个数据库页面",
      "type": "n8n-nodes-base.notion",
      "position": [
        540,
        140
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "224315ef-5fbb-804c-b0ac-daa3fd2204d1",
          "cachedResultUrl": "https://www.notion.so/224315ef5fbb804cb0acdaa3fd2204d1",
          "cachedResultName": "Feature Tracker"
        }
      },
      "credentials": {
        "notionApi": {
          "id": "m58S8v9iNfyHkNCa",
          "name": "Notion account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "35ccdc8d-063d-4177-9dbf-ef5ab0490083",
      "name": "创建问题",
      "type": "n8n-nodes-base.github",
      "position": [
        1260,
        -760
      ],
      "webhookId": "83ec3e24-50a4-4671-be98-ca979017b807",
      "parameters": {
        "body": "={{ $json.Description }}",
        "owner": {
          "__rl": true,
          "mode": "list",
          "value": "From6Agency",
          "cachedResultUrl": "https://github.com/From6Agency",
          "cachedResultName": "From6Agency"
        },
        "title": "={{ $json.Title }}",
        "labels": [],
        "assignees": [],
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.Repository }}"
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "id": "Gln4s2VSz3SN6tZc",
          "name": "GitHub account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "15822ab6-75eb-42f6-9735-462eee577f01",
      "name": "排序问题字段",
      "type": "n8n-nodes-base.set",
      "position": [
        740,
        140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ec9e556b-db8d-4c84-9278-ddae3c03dae4",
              "name": "Title",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "2f44fef2-db01-4d86-97d8-24e860b9191f",
              "name": "Description",
              "type": "string",
              "value": "={{ $json.property_description }}"
            },
            {
              "id": "262ee63f-14a6-4779-85e4-38d0a0eb1b45",
              "name": "Labels",
              "type": "string",
              "value": "={{ $json.property_labels[0] }}"
            },
            {
              "id": "93645af7-ae3f-476d-ab0a-ca4bb454f89a",
              "name": "Repository",
              "type": "string",
              "value": "={{ $json.property_repository[0] }}"
            },
            {
              "id": "7e55b3f9-1d18-43c0-8311-54c267613f72",
              "name": "Status",
              "type": "string",
              "value": "={{ $json.property_status }}"
            },
            {
              "id": "0050711a-c0af-473f-8e3f-6fca52dd96da",
              "name": "DatabasePageId",
              "type": "string",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ab5feb3b-b90b-46b8-817e-4d5304f1c052",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        300,
        140
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 12
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5d1c0a93-e655-40b6-800d-95fa9a45fb5a",
      "name": "获取多个用户",
      "type": "n8n-nodes-base.notion",
      "position": [
        1300,
        460
      ],
      "parameters": {
        "resource": "user",
        "operation": "getAll"
      },
      "credentials": {
        "notionApi": {
          "id": "m58S8v9iNfyHkNCa",
          "name": "Notion account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "26fb5264-ecc5-41c7-ba4b-190299ebe133",
      "name": "映射 Notion 用户",
      "type": "n8n-nodes-base.set",
      "position": [
        1480,
        460
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d7fa28c1-b8fd-4696-9c54-1fbfc1ecfeeb",
              "name": "Name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "2d2bf9ae-2a65-4550-b5ab-2ba3c80af59f",
              "name": "Email",
              "type": "string",
              "value": "={{ $json.person.email }}"
            },
            {
              "id": "399b3419-f7c1-4a4d-866c-b376f264bdf5",
              "name": "type",
              "type": "string",
              "value": "={{ $json.type }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bf194122-52fb-466d-9532-21edd54857c7",
      "name": "设置状态和问题 URL",
      "type": "n8n-nodes-base.notion",
      "position": [
        1540,
        -760
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Switch').item.json.DatabasePageId }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Status|status",
              "statusValue": "In progress"
            },
            {
              "key": "Issue URL|url",
              "urlValue": "={{ $json.html_url }}",
              "ignoreIfEmpty": true
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "id": "m58S8v9iNfyHkNCa",
          "name": "Notion account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "41f0a8c9-df5f-4fa8-a4e1-ed10017d1688",
      "name": "条件分支",
      "type": "n8n-nodes-base.switch",
      "position": [
        980,
        140
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c494ba90-0e31-44f0-b7d3-9d59b42fbc67",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Status }}",
                    "rightValue": "To develop"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e2566cab-fc35-4ef9-ba23-44a2c128b61c",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Status }}",
                    "rightValue": "Done"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "3d653edc-4d9e-4efc-98b2-83ef168bc962",
      "name": "排除机器人",
      "type": "n8n-nodes-base.switch",
      "position": [
        1660,
        460
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0abb60d1-baa3-42e2-9ced-913b24bf727d",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.type }}",
                    "rightValue": "person"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "b4ce6176-284a-45d7-a852-e456a596f833",
      "name": "发送消息",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2060,
        460
      ],
      "webhookId": "0fac39e9-7020-44a0-98fd-b0cb16487604",
      "parameters": {
        "sendTo": "={{ $json.Email.join(', ') }}",
        "message": "=Your message stipulating that the issue  {{ $('Switch').item.json.Title }} has been marked as Done and closed within the {{ $('Switch').item.json.Repository }} repository.",
        "options": {},
        "subject": "A Github Issue has been closed !",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "9B0IqBqjWC8gKOUn",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "3b0bc8f4-4d6c-4c52-b123-78583df2ab89",
      "name": "分组收件人",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1880,
        460
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "Email"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5becc075-f6b8-4c57-8489-7152e9616ec6",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        -720
      ],
      "parameters": {
        "color": 6,
        "width": 880,
        "height": 1100,
        "content": "## 🔹 第一部分:从 Notion 检测和排序问题"
      },
      "typeVersion": 1
    },
    {
      "id": "246e38b3-eb3d-47f8-9818-e0c48e9c308f",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1160,
        -1360
      ],
      "parameters": {
        "color": 4,
        "width": 640,
        "height": 760,
        "content": "## 🔹 SECTION 2: GitHub Issue Creation (IF \"To develop\")\n**Combining**: GitHub Node + Notion Update\n\n## 🐙 5. Create an Issue (GitHub)\n🔧 **Node Type**: GitHub → Create Issue\n\n## ⚙️ What it does: Creates a new issue on the GitHub repo defined in the Notion row.\n\n## 📥 Inputs: Uses dynamic fields: Title, Description, Labels, Repository.\n\n## 🧩 6. Set Status and Issue URL (Notion Update)\n🔧 **Node Type**: Notion → Update Database Page\n\n## 🧠 Role: Updates the status of the issue in Notion to In progress and stores the created GitHub Issue URL."
      },
      "typeVersion": 1
    },
    {
      "id": "7a5f0935-2dc8-4db4-8044-1f261b1820dd",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        -380
      ],
      "parameters": {
        "color": 3,
        "width": 960,
        "height": 1020,
        "content": "## 🔹 SECTION 3: Notify Team on Already In-Progress Items (IF NOT \"To develop\")\nCombining: Notion Users + Filtering + Email Grouping + Gmail\n\n## 👥 7. Get Many Users (Notion Users)\n🔧 **Node Type**: Notion → Get All Users\n\n## 📥 What it does: Retrieves the list of team members (to be notified).\n\n## 🧠 8. Map Notion Users\n🔧 **Node Type**: Set\n\n## 📋 Role: Maps and formats data for each user (e.g., Name, Email, Role).\n\n## 🧹 9. Exclude Bot\n🔧 **Node Type**: Switch\n\n## 🚫 What it does: Excludes automation/bot users (e.g., notifications@noreply).\n\n## 🧮 10. Group Recipients\n🔧 **Node Type**: Aggregate\n\n## 🎯 Goal: Collects all user emails into a single array to send one email to all recipients.\n\n## 📬 11. Send a Message (Gmail)\n🔧 **Node Type**: Gmail → Send Email"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7768a0ea-4dad-4586-b6b7-46b82a036dce",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Create an issue",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get many users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Exclude Bot": {
      "main": [
        [
          {
            "node": "Group Recipients",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many users": {
      "main": [
        [
          {
            "node": "Map Notion Users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create an issue": {
      "main": [
        [
          {
            "node": "Set Status and Issue URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group Recipients": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Notion Users": {
      "main": [
        [
          {
            "node": "Exclude Bot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get many database pages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort Issues Fields": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many database pages": {
      "main": [
        [
          {
            "node": "Sort Issues Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 项目管理

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流