Sync des commentaires de code vers FAQ (GitHub)

Avancé

Ceci est unEngineering, AI Chatbotworkflow d'automatisation du domainecontenant 18 nœuds.Utilise principalement des nœuds comme If, Code, Slack, Notion, GoogleSheets. Réponse automatique aux questions sur les PR GitHub pour les équipes de développement avec GPT-4o, Notion et Slack

Prérequis
  • Token Bot Slack ou URL Webhook
  • Clé API Notion
  • Informations d'identification Google Sheets API
  • Personal Access Token GitHub
  • Clé API OpenAI
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "ZtkkWwiBICaiGc4g",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "Code Comment-to-FAQ Sync (GitHub)",
  "tags": [],
  "nodes": [
    {
      "id": "5b60a73e-3918-4730-b195-ac429b2f5acf",
      "name": "Configurer le Modèle GPT-4o",
      "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": "Note adhésive",
      "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": "Note adhésive1",
      "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": "Note adhésive2",
      "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": "Note adhésive3",
      "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": "Note adhésive4",
      "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": "Note adhésive5",
      "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": "Note adhésive6",
      "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": "Note adhésive7",
      "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": "Déclencheur de Commentaire PR GitHub",
      "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": "Valider le Payload Webhook GitHub",
      "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": "Détecter la Question du Développeur dans le Commentaire PR",
      "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": "Générer une Réponse IA pour la Question du Développeur",
      "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": "Extraire les Métadonnées du Commentaire GitHub",
      "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": "Sauvegarder l'Analyse du Commentaire dans la Base de Données Notion",
      "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": "Logger les Erreurs dans Google Sheets",
      "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": "Note adhésive8",
      "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": "Publier la Réponse IA & Lien PR sur Slack",
      "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": "c4f82baa-ca82-4858-8d2f-2e9dd7febe3c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "433930c9-f10d-4db5-b419-9ed8a1adb5d0": {
      "main": [
        [
          {
            "node": "3c1ef780-1b15-4932-9aa9-99cb89f4195b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c4f82baa-ca82-4858-8d2f-2e9dd7febe3c": {
      "main": [
        [
          {
            "node": "a739f228-5357-4ab7-bee6-62b7929d08df",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "828abb32-ab14-4a13-aaf8-2d0723df639d",
            "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
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Ingénierie, Chatbot IA

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds18
Catégorie2
Types de nœuds9
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

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

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34