8
n8n 中文网amn8n.com

使用Gemini AI将GitHub热门仓库自动生成周教程并发布到WordPress

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 Code, SplitOut, EmailSend, Wordpress, HttpRequest 等节点。 使用Gemini AI将GitHub热门仓库自动生成周教程并发布到WordPress

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
  },
  "nodes": [
    {
      "id": "a821ae55-bb91-4a7b-9962-2cbe3c83ead9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -208
      ],
      "parameters": {
        "width": 380,
        "height": 440,
        "content": "## 每周教程生成器"
      },
      "typeVersion": 1,
      "Google Gemini Chat Model": {
        "ai_languageModel": [
          [
            {
              "node": "AI Tutorial Generator",
              "type": "ai_languageModel",
              "index": 0
            }
          ]
        ]
      }
    },
    {
      "id": "8c8478b1-b8dd-486e-890b-06fc4653832b",
      "name": "每周一上午 10 点",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        16,
        80
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 10 * * 1"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0fa5dbc6-78a8-4bf7-858a-b1789f2933ff",
      "name": "获取热门仓库",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        80
      ],
      "parameters": {
        "url": "https://api.github.com/search/repositories",
        "options": {}
      },
      "typeVersion": 4.1
    },
    {
      "id": "24c45e82-449d-42c7-a9b3-23a3771890ca",
      "name": "AI 教程生成器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        688,
        80
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a technical tutorial writer. Based on the provided GitHub repository information, create a comprehensive tutorial that teaches developers how to build something similar or use this technology. Include: 1) Introduction and overview, 2) Prerequisites, 3) Step-by-step implementation guide with code examples, 4) Best practices, 5) Common pitfalls to avoid, 6) Next steps and resources. Make it beginner-friendly but technically accurate. Format with proper markdown including code blocks."
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "428f39bc-ee5a-4a98-b15d-cb432eb67261",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        768,
        304
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "wNw45YZvXXpeocJ2",
          "name": "TST API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f7e650f7-ec34-4aa3-b534-8232dff02270",
      "name": "创建教程帖子",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        1264,
        80
      ],
      "parameters": {
        "title": "=Tutorial: Building with {{$json.name}} - {{$json.language}} Guide",
        "additionalFields": {
          "tags": [
            "tutorial",
            "{{$json.language}}",
            "development",
            "guide",
            "{{$json.name}}"
          ],
          "status": "draft",
          "content": "",
          "categories": [
            "Tutorials",
            "Programming",
            "{{$json.language}}"
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3b9f51a2-c4c0-49f5-b12c-161ec09754f7",
      "name": "通知管理员",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1488,
        80
      ],
      "webhookId": "721daf9a-7dd8-4cbb-a480-19c08487d65a",
      "parameters": {
        "options": {},
        "subject": "=New Tutorial Draft Created: {{$json.name}}"
      },
      "credentials": {
        "smtp": {
          "id": "0xVva6dyyi5SuxBe",
          "name": "SMTP account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b7eb9512-221d-4347-83cb-ed37e9342672",
      "name": "拆分仓库项目",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        464,
        80
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "5c38943d-e55a-490e-90e5-be4154243db3",
      "name": "解析 AI 教程输出",
      "type": "n8n-nodes-base.code",
      "position": [
        1040,
        80
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nreturn items.map(item => {\n  // Parse the AI tutorial output\n  let aiOutput = item.json.output;\n  \n  // Remove markdown code blocks if present\n  aiOutput = aiOutput.replace(/```json\\s*/, '').replace(/```\\s*$/, '');\n  \n  // Try to parse as JSON, fallback to using the content directly\n  let parsedOutput;\n  try {\n    parsedOutput = JSON.parse(aiOutput.trim());\n  } catch (e) {\n    // If not JSON, treat as plain markdown content\n    parsedOutput = {\n      title: `Tutorial: Building with ${item.json.name} - ${item.json.language} Guide`,\n      content: aiOutput\n    };\n  }\n  \n  return {\n    json: {\n      title: parsedOutput.title || `Tutorial: Building with ${item.json.name} - ${item.json.language} Guide`,\n      content: parsedOutput.content || aiOutput,\n      repoName: item.json.name,\n      language: item.json.language,\n      description: item.json.description,\n      url: item.json.html_url,\n      stars: item.json.stargazers_count\n    }\n  };\n});"
      },
      "typeVersion": 2
    }
  ],
  "pinData": {},
  "connections": {
    "Get Trending Repos": {
      "main": [
        [
          {
            "node": "Split Repository Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Monday 10AM": {
      "main": [
        [
          {
            "node": "Get Trending Repos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Tutorial Post": {
      "main": [
        [
          {
            "node": "Notify Admin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Tutorial Generator": {
      "main": [
        [
          {
            "node": "Parse the AI tutorial output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Repository Items": {
      "main": [
        [
          {
            "node": "AI Tutorial Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Tutorial Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Parse the AI tutorial output": {
      "main": [
        [
          {
            "node": "Create Tutorial Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 内容创作, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量9
分类2
节点类型9
难度说明

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

作者
David Olusola

David Olusola

@dae221

I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - david@daexai.com

外部链接
在 n8n.io 查看

分享此工作流