Code-Kommentare in FAQ-Synchronisierung (GitHub)

Experte

Dies ist ein Engineering, AI Chatbot-Bereich Automatisierungsworkflow mit 18 Nodes. Hauptsächlich werden If, Code, Slack, Notion, GoogleSheets und andere Nodes verwendet. Automatische Beantwortung von GitHub-PR-Fragen durch GPT-4o, Notion und Slack für das Entwicklungsteam

Voraussetzungen
  • Slack Bot Token oder Webhook URL
  • Notion API Key
  • Google Sheets API-Anmeldedaten
  • GitHub Personal Access Token
  • OpenAI API Key
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "id": "ZtkkWwiBICaiGc4g",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "Code Comment-to-FAQ Sync (GitHub)",
  "tags": [],
  "nodes": [
    {
      "id": "5b60a73e-3918-4730-b195-ac429b2f5acf",
      "name": "GPT-4o-Modell konfigurieren",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        144,
        144
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "C3WzT18XqF8OdVM6",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2b63fa67-e389-43a5-ab07-0a54a890dd57",
      "name": "Haftnotiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        -400
      ],
      "parameters": {
        "height": 448,
        "content": "## Node Name: GitHub PR Comment Trigger\n**Action**: Starts the workflow when a pull-request comment event occurs in GitHub.\n**Description**:\nThis node listens for the `pull_request_review_comment` webhook from a specified repository (`weather-app`) and user.  \nWhenever a developer comments on a PR, this node captures the event payload — including comment text, file path, PR number, and author — to start the automation chain.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "49031929-9cdb-4a5e-97e4-cfbcaa93fd1f",
      "name": "Haftnotiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        144
      ],
      "parameters": {
        "height": 368,
        "content": "## Node Name: Validate GitHub Webhook Payload\n**Action**: Checks if the incoming PR comment data is valid and complete.\n**Description**:\nBefore processing, this node verifies that the GitHub payload includes a valid comment URL.  \nIf the webhook is malformed or missing fields, the workflow routes execution to the error-logging path to prevent failed AI or Notion operations.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7df85bda-9810-4dc0-97c6-4280bffcf513",
      "name": "Haftnotiz2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        448
      ],
      "parameters": {
        "height": 384,
        "content": "## Node Name: Log Errors in Google Sheets\n**Action**: Records any webhook or processing errors in a shared Google Sheet.\n**Description**:\nIf validation fails or data parsing encounters issues, this node logs the error details (error ID + message) in the “error log sheet.”  \nThis ensures complete visibility into failed webhook events and AI generation errors for future troubleshooting.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9eae3668-e27a-46ec-925b-e187ebb38d39",
      "name": "Haftnotiz3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -528
      ],
      "parameters": {
        "height": 432,
        "content": "## Node Name: Generate AI Response for Developer Question\n**Action**: Uses GPT-4o to draft a clear, concise reply to the developer’s PR comment.\n**Description**:\nThis agent node sends the extracted GitHub comment text and PR context to GPT-4o.  \nThe AI analyzes the query and returns a brief (2–3 line) technical answer that can later be stored or displayed for review.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7298a7db-60d9-4891-99d4-17ab86e2eb26",
      "name": "Haftnotiz4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -512
      ],
      "parameters": {
        "height": 416,
        "content": "## Node Name: Extract GitHub Comment Metadata\n**Action**: Parses and structures key GitHub comment details into a clean JSON object.\n**Description**:\nUsing a JavaScript Code node, this step extracts repository name, comment content, author username, file path, and PR number from the original webhook payload.  \nIt standardizes the data so it can be easily stored in Notion.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b149f1f2-65a2-4a0b-8736-e556a6caf632",
      "name": "Haftnotiz5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        160
      ],
      "parameters": {
        "height": 432,
        "content": "## Node Name: Save Comment Insight to Notion Database\n**Action**: Appends the processed comment data and AI response into a Notion database.\n**Description**:\nThis node creates a new page entry in a Notion database (“test db”) capturing details like repository, username, comment body, file path, and PR number.  \nIt serves as a living documentation hub for tracking developer queries and AI answers from GitHub PRs.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5d286fc7-9919-4102-8afc-c6f12933c510",
      "name": "Haftnotiz6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        272
      ],
      "parameters": {
        "height": 352,
        "content": "## Node Name: Configure GPT-4o Model\n**Action**: Establishes the Azure OpenAI GPT-4o model connection for AI processing.\n**Description**:\nThis node defines and connects to the GPT-4o model hosted on Azure OpenAI.  \nIt serves as the language engine for generating short, precise, and context-aware technical responses to developer comments.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f035aa9a-2f76-4de6-a451-84a00dbb690e",
      "name": "Haftnotiz7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        -464
      ],
      "parameters": {
        "height": 400,
        "content": "## Node Name: Detect Developer Question in PR Comment\n**Action**: Evaluates whether a PR comment contains a question like “how do I…” or “how to…”.\n**Description**:\nThis conditional node scans the text of the GitHub comment for help-related keywords.  \nIf the comment is a technical query, it routes the flow to the AI assistant for generating a concise answer. Otherwise, the workflow ends silently.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c6e89357-de32-4be6-bbe0-f486751ead92",
      "name": "GitHub PR-Kommentar-Trigger",
      "type": "n8n-nodes-base.githubTrigger",
      "position": [
        -672,
        -32
      ],
      "webhookId": "1114ba07-d98e-4751-80f2-119a9394f666",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "saurabhg97"
        },
        "events": [
          "pull_request_review_comment"
        ],
        "options": {},
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "weather-app"
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "id": "rnLgyYy9XPnp6GZ9",
          "name": "saurabh github"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c4f82baa-ca82-4858-8d2f-2e9dd7febe3c",
      "name": "GitHub Webhook-Trigger-Nutzlast validieren",
      "type": "n8n-nodes-base.if",
      "position": [
        -400,
        -32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e2adb005-2b3c-4d1e-8445-442df1fe925a",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.comment.url }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a739f228-5357-4ab7-bee6-62b7929d08df",
      "name": "Entwicklerfrage in PR-Kommentar erkennen",
      "type": "n8n-nodes-base.if",
      "position": [
        -112,
        -48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2ad8bc15-beaa-4606-9a8d-ecfd38e446cb",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ \n  (\n    $json[\"body\"][\"comment\"][\"body\"].toLowerCase().includes(\"how do i\") ||\n    $json[\"body\"][\"comment\"][\"body\"].toLowerCase().includes(\"how to\")\n  ).toString()\n}}\n",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5b0d7c5e-cc2d-44fd-9cf2-b6edfc5e08bc",
      "name": "KI-Antwort auf Entwicklerfrage generieren",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        192,
        -64
      ],
      "parameters": {
        "text": "={{ \n`Question: ${$json[\"body\"][\"comment\"][\"body\"]}\n\nContext: PR Link - ${$json[\"body\"][\"comment\"][\"html_url\"]}\nRepository: ${$json[\"body\"][\"repository\"][\"full_name\"]}\n` \n}}\n",
        "options": {
          "systemMessage": "=You are a helpful developer assistant. \nProvide short, clear, and technically correct answers (2–3 lines max) to developer questions found in GitHub PR comments.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "433930c9-f10d-4db5-b419-9ed8a1adb5d0",
      "name": "GitHub Kommentar-Metadaten extrahieren",
      "type": "n8n-nodes-base.code",
      "position": [
        544,
        -64
      ],
      "parameters": {
        "jsCode": "// Access the original webhook data\nconst webhookData = $(' GitHub PR Comment Trigger').first().json;\n\nreturn [\n  {\n    json: {\n      repository: webhookData.body.repository.full_name,\n      comment: webhookData.body.comment.body,\n      username: webhookData.body.comment.user.login,\n      file_path: webhookData.body.comment.path,\n      pr_number: webhookData.body.pull_request.number\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "3c1ef780-1b15-4932-9aa9-99cb89f4195b",
      "name": "Kommentar-Erkenntnis in Notion-Datenbank speichern",
      "type": "n8n-nodes-base.notion",
      "position": [
        784,
        -64
      ],
      "parameters": {
        "title": "={{ $json.repository }}",
        "simple": false,
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "265802b9-1fa0-806f-a52a-e6d71d9ff2e0",
          "cachedResultUrl": "https://www.notion.so/265802b91fa0806fa52ae6d71d9ff2e0",
          "cachedResultName": "test db"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Name|title",
              "title": "={{ $json.comment }}"
            },
            {
              "key": "Name|title",
              "title": "={{ $json.username }}"
            },
            {
              "key": "Name|title",
              "title": "={{ $now }}"
            },
            {
              "key": "Name|title",
              "title": "={{ $json.file_path }}"
            },
            {
              "key": "Name|title",
              "title": "={{ String($json.pr_number) }}\n"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "id": "iDjtgSTYG9ECVBtT",
          "name": "Notion account 2"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "828abb32-ab14-4a13-aaf8-2d0723df639d",
      "name": "Fehler in Google Tabellen protokollieren",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -128,
        256
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "error_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "error_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1338537721,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit#gid=1338537721",
          "cachedResultName": "error log sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit?usp=drivesdk",
          "cachedResultName": "Interviewer Brief Pack "
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "5f0bdf64-2400-416f-a2b0-5b8a19bba710",
      "name": "Haftnotiz8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        160
      ],
      "parameters": {
        "height": 576,
        "content": "## Node Name: Post AI Answer & PR Link to Slack\n**Action**: Sends the generated AI response and the GitHub PR comment link to a Slack channel or user.\n**Description**:\nThis node posts the AI-generated technical answer (from “Generate AI Response for Developer Question”) directly to Slack, followed by the original GitHub PR comment link for quick context.  \nIt ensures that the internal team (or reviewer) is instantly notified whenever a developer’s query is processed by the AI system — allowing faster review and collaboration inside Slack.  \nTypically used to streamline developer feedback loops and keep AI-assisted responses visible to the engineering team in real time.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "945e97e6-b51a-4771-931b-02ab81ef902b",
      "name": "KI-Antwort & PR-Link an Slack senden",
      "type": "n8n-nodes-base.slack",
      "position": [
        1056,
        -64
      ],
      "webhookId": "ddaa7632-9e35-4bd3-82d6-572d5cae84cc",
      "parameters": {
        "text": "={{ $('Generate AI Response for Developer Question').item.json.output }}{{ $('Detect Developer Question in PR Comment').item.json.body.comment.url }}",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09HMPVD466",
          "cachedResultName": "newscctv22"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9f9ae9c5-9555-4e6d-94e6-2891348064ae",
  "connections": {
    "5b60a73e-3918-4730-b195-ac429b2f5acf": {
      "ai_languageModel": [
        [
          {
            "node": "5b0d7c5e-cc2d-44fd-9cf2-b6edfc5e08bc",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "c6e89357-de32-4be6-bbe0-f486751ead92": {
      "main": [
        [
          {
            "node": "GitHub Webhook-Nutzlast validieren",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "433930c9-f10d-4db5-b419-9ed8a1adb5d0": {
      "main": [
        [
          {
            "node": "3c1ef780-1b15-4932-9aa9-99cb89f4195b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub Webhook-Nutzlast validieren": {
      "main": [
        [
          {
            "node": "a739f228-5357-4ab7-bee6-62b7929d08df",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fehler in Google Sheets protokollieren",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a739f228-5357-4ab7-bee6-62b7929d08df": {
      "main": [
        [
          {
            "node": "5b0d7c5e-cc2d-44fd-9cf2-b6edfc5e08bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3c1ef780-1b15-4932-9aa9-99cb89f4195b": {
      "main": [
        [
          {
            "node": "945e97e6-b51a-4771-931b-02ab81ef902b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5b0d7c5e-cc2d-44fd-9cf2-b6edfc5e08bc": {
      "main": [
        [
          {
            "node": "433930c9-f10d-4db5-b419-9ed8a1adb5d0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Experte - Engineering, KI-Chatbot

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes18
Kategorie2
Node-Typen9
Schwierigkeitsbeschreibung

Für fortgeschrittene Benutzer, komplexe Workflows mit 16+ Nodes

Autor
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.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34