{
  "id": "x0albhzs79R3Tmfm",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Documentation Sync Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "e6f72597-24f7-46f9-bf57-df361d91d2c0",
      "name": "Listen for PR Events",
      "type": "n8n-nodes-base.githubTrigger",
      "position": [
        -2064,
        176
      ],
      "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": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "155ef9cd-fe67-4af8-90b7-8cd33ab904af",
      "name": "\ud83d\udccb Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2384,
        80
      ],
      "parameters": {
        "width": 250,
        "height": 300,
        "content": "\ud83d\ude80 WORKFLOW START\n\nThis workflow monitors GitHub pull requests and automatically syncs documentation to Confluence when changes are merged to the main branch.\n\n\u2022 Triggers on PR events\n\u2022 Validates PR is merged to main\n\u2022 Detects doc changes\n\u2022 Updates Confluence\n\u2022 Notifies team via Slack"
      },
      "typeVersion": 1
    },
    {
      "id": "17016417-98fe-437d-bc8a-0dc47f78f737",
      "name": "Is PR Merged to Main?",
      "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": "\ud83d\udd0d Validation Gate",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1952,
        352
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "\u2705 VALIDATION GATE\n\nChecks if the pull request:\n\u2713 Is targeting the 'main' branch\n\u2713 Has been merged (merged = true)\n\nOnly proceeds if BOTH conditions are met. This prevents syncing of unmerged or draft PRs."
      },
      "typeVersion": 1
    },
    {
      "id": "ecd617ef-c912-463c-b33f-a5d4754465ef",
      "name": "Fetch README Content",
      "type": "n8n-nodes-base.github",
      "position": [
        -1616,
        176
      ],
      "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": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "cf09bbcd-f959-4ae1-8c1e-7c902072910f",
      "name": "\ud83d\udce5 File Retrieval",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1712,
        -128
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "\ud83d\udce5 GITHUB FILE RETRIEVAL\n\nFetches the README.md file from the repository to:\n\u2022 Extract documentation content\n\u2022 Pass to change detection\n\u2022 Provide context for AI summarization\n\nUses GitHub OAuth2 for authentication"
      },
      "typeVersion": 1
    },
    {
      "id": "456cf796-a361-4d82-afea-9bc66fe7f429",
      "name": "Are Docs Modified?",
      "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": "\ud83d\udd0e Doc Detection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        352
      ],
      "parameters": {
        "width": 280,
        "height": 320,
        "content": "\ud83d\udd0e DOCUMENTATION DETECTION\n\nScans the PR payload for keywords:\n\u2713 'docs' folder changes\n\u2713 'README' file modifications\n\u2713 'openapi' spec updates\n\nIf ANY documentation changes detected:\n\u2192 Routes to AI summarization\n\u2192 Updates Confluence\n\u2192 Notifies team\n\nOtherwise: Workflow ends"
      },
      "typeVersion": 1
    },
    {
      "id": "622f0344-42a4-477c-ae9a-0a7c5b4c7355",
      "name": "AI Summarizer Agent",
      "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": "\ud83e\udd16 AI Agent",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -384
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "\ud83e\udd16 AI SUMMARIZATION\n\nUses Azure OpenAI to:\n\u2022 Analyze doc changes\n\u2022 Generate concise summary\n\u2022 2-3 sentence summary format\n\nOutput used for:\n\u2192 Confluence update descriptions\n\u2192 Slack notification message"
      },
      "typeVersion": 1
    },
    {
      "id": "41f13861-a2bf-4c35-b1ea-82f2e275768f",
      "name": "Azure OpenAI Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -864,
        240
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f7559c04-28b2-4e3c-bb7d-06436e8524fd",
      "name": "\u2699\ufe0f LLM Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -736,
        208
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "\u2699\ufe0f LLM CONFIGURATION\n\nModel: GPT-4o Mini\nProvider: Azure OpenAI\n\nFeatures:\n\u2022 Fast processing\n\u2022 Cost-efficient\n\u2022 Context-aware summarization\n\nConnected to AI Agent for intelligent analysis"
      },
      "typeVersion": 1
    },
    {
      "id": "9f005c0f-1416-4166-9d83-a26b658f0b84",
      "name": "Alert Docs Team (Slack)",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1056,
        320
      ],
      "parameters": {
        "text": "\ud83d\udce2 *Docs Auto-Synced!*\n\ud83d\udce6 Repo: {{$json[\"body\"][\"repository\"][\"full_name\"]}}\n\ud83c\udf3f Branch: {{$json[\"body\"][\"pull_request\"][\"base\"][\"ref\"]}}\n\ud83d\udc64 Author: {{$json[\"body\"][\"pull_request\"][\"user\"][\"login\"]}}\n\ud83d\udcdd Title: {{$json[\"body\"][\"pull_request\"][\"title\"]}}\n\ud83d\udd17 PR: {{$json[\"body\"][\"pull_request\"][\"html_url\"]}}",
        "channel": "#documentation-updates",
        "attachments": [],
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "205d8659-f97b-4310-ac09-0174da664684",
      "name": "\ud83d\udce2 Slack Alert",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        512
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "\ud83d\udce2 SLACK NOTIFICATION\n\nSends message to #documentation-updates with:\n\u2713 Auto-sync confirmation\n\u2713 Repository name\n\u2713 Target branch\n\u2713 Author name\n\u2713 PR title\n\u2713 PR link\n\nKeeps team informed of doc updates in real-time"
      },
      "typeVersion": 1
    },
    {
      "id": "8e8c820c-ad01-40e9-b269-e1fa4f1ffc4f",
      "name": "Post AI Summary to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -816,
        16
      ],
      "parameters": {
        "text": "\ud83d\udd14 Documentation changes detected:\n{{$json}}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09GNB90TED",
          "cachedResultName": "general-information"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "31816220-f24d-47b2-ae2f-737e1157ed0e",
      "name": "\ud83d\udce4 Summary Post",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -272
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "\ud83d\udce4 AI SUMMARY TO SLACK\n\nChannel: general-information\n\nPosts AI-generated summary to:\n\u2022 Keep team informed\n\u2022 Share key changes\n\u2022 Link to PR details\n\u2022 Enable quick reviews"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "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
          }
        ]
      ]
    }
  }
}