从 GitHub 恢复工作流
中级
这是一个DevOps, AI领域的自动化工作流,包含 14 个节点。主要使用 N8n, Set, Filter, Github, SplitOut 等节点,结合人工智能技术实现智能自动化。 在拉取请求合并后将 GitHub 工作流同步至 n8n
前置要求
- •GitHub Personal Access Token
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "tGB3Dw1JjDFCrHuL",
"meta": {
"instanceId": "e76981884963d13b9deb7bc5a6b15daf6838937e1dd529f22f2c146d8b79cae4",
"templateCredsSetupCompleted": true
},
"name": "从 GitHub 恢复工作流",
"tags": [],
"nodes": [
{
"id": "4da3bb85-e6f9-406b-a7d5-fee1064da2a4",
"name": "定义局部变量",
"type": "n8n-nodes-base.set",
"position": [
200,
-200
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "18dc3ecc-c1c7-4197-9268-3898636323bc",
"name": "github_owner",
"type": "string",
"value": "duynb92"
},
{
"id": "b3778554-4200-4e51-842a-dfca05be4f85",
"name": "repo_name",
"type": "string",
"value": "n8n-workflows"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "4b36dfdb-6e69-4590-b47a-326198368a86",
"name": "Github 触发器 - 当有新拉取请求时",
"type": "n8n-nodes-base.githubTrigger",
"position": [
-20,
-200
],
"webhookId": "4152c250-0d25-4a1b-8064-1d170c527daf",
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "duynb92"
},
"events": [
"pull_request"
],
"options": {},
"repository": {
"__rl": true,
"mode": "list",
"value": "n8n-workflows",
"cachedResultUrl": "https://github.com/duynb92/n8n-workflows",
"cachedResultName": "n8n-workflows"
}
},
"credentials": {
"githubApi": {
"id": "YmjprOSeOsMISV4R",
"name": "GitHub account - Access token classic"
}
},
"typeVersion": 1
},
{
"id": "74b7816b-48f2-4c1e-a636-fcbfb422a5e8",
"name": "检查触发事件是否为拉取请求合并",
"type": "n8n-nodes-base.filter",
"position": [
420,
-200
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7f447d9f-6a55-4c4c-b9c5-d1f5b5fb1476",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Github Trigger - When there is new pull request').item.json.body.action }}",
"rightValue": "closed"
},
{
"id": "ab94d15e-ee80-4f78-8a1a-b9db0c2161ec",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $('Github Trigger - When there is new pull request').item.json.body.pull_request.merged }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f72522ad-d28d-42ed-95a5-45927c264596",
"name": "通过 GitHub API 获取合并提交详情",
"type": "n8n-nodes-base.httpRequest",
"position": [
640,
-200
],
"parameters": {
"url": "=https://api.github.com/repos/{{ $('Define Local Variables').item.json.github_owner }}/{{ $('Define Local Variables').item.json.repo_name }}/commits/{{ $('Github Trigger - When there is new pull request').item.json.body.pull_request.merge_commit_sha }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "githubApi"
},
"credentials": {
"githubApi": {
"id": "R8n2QZnsA7dlSq4d",
"name": "GitHub account"
}
},
"typeVersion": 4.2
},
{
"id": "a97abd34-fd58-4b81-bacb-3cab9d58499b",
"name": "获取文件变更详情",
"type": "n8n-nodes-base.splitOut",
"position": [
860,
-200
],
"parameters": {
"options": {},
"fieldToSplitOut": "files"
},
"typeVersion": 1
},
{
"id": "2aab8ec7-7bbf-4909-9175-d6ef503318ae",
"name": "筛选已修改的工作流",
"type": "n8n-nodes-base.filter",
"position": [
1080,
-300
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cd4529cc-cf44-4fd9-aa27-49a5557a40ca",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "modified"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "5b14e46f-6bac-4e15-8a66-45fccc1ae624",
"name": "筛选新建的工作流",
"type": "n8n-nodes-base.filter",
"position": [
1080,
-100
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b4d2e160-478b-45e0-ba5d-ea72c2f6d430",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "added"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e85cff90-626c-4673-8d94-0b5a8848d5be",
"name": "从 Git 获取工作流内容",
"type": "n8n-nodes-base.github",
"position": [
1300,
-100
],
"webhookId": "afd9f010-9707-4778-bc4a-d933198d8727",
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $('Define Local Variables').item.json.github_owner }}"
},
"filePath": "={{ $json.filename }}",
"resource": "file",
"operation": "get",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $('Define Local Variables').item.json.repo_name }}"
},
"asBinaryProperty": false,
"additionalParameters": {}
},
"credentials": {
"githubApi": {
"id": "R8n2QZnsA7dlSq4d",
"name": "GitHub account"
}
},
"typeVersion": 1.1
},
{
"id": "d0cc850d-3270-40f8-99ac-363ec8986487",
"name": "从 Git 获取工作流内容1",
"type": "n8n-nodes-base.github",
"position": [
1300,
-300
],
"webhookId": "afd9f010-9707-4778-bc4a-d933198d8727",
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $('Define Local Variables').item.json.github_owner }}"
},
"filePath": "={{ $json.filename }}",
"resource": "file",
"operation": "get",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $('Define Local Variables').item.json.repo_name }}"
},
"asBinaryProperty": false,
"additionalParameters": {}
},
"credentials": {
"githubApi": {
"id": "R8n2QZnsA7dlSq4d",
"name": "GitHub account"
}
},
"typeVersion": 1.1
},
{
"id": "157304a2-c198-4f8c-ac69-81f6adaad00b",
"name": "将工作流内容解码为 JSON",
"type": "n8n-nodes-base.set",
"position": [
1520,
-300
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={{ $json.content.base64Decode() }}"
},
"typeVersion": 3.4
},
{
"id": "8dee2b87-85c7-42d0-b35f-fbe0107de733",
"name": "将工作流内容解码为 JSON1",
"type": "n8n-nodes-base.set",
"position": [
1520,
-100
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={{ $json.content.base64Decode() }}"
},
"typeVersion": 3.4
},
{
"id": "2ffb439f-cacf-4af2-9f57-1f2ea94c5eae",
"name": "在 n8n 中更新工作流",
"type": "n8n-nodes-base.n8n",
"position": [
1740,
-300
],
"parameters": {
"operation": "update",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"requestOptions": {},
"workflowObject": "={{ $json.toJsonString() }}"
},
"credentials": {
"n8nApi": {
"id": "f2iSnAHCaePA8jyU",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "21bab1a6-5481-4728-a3fc-3749db3e4ca6",
"name": "在 n8n 中创建新工作流",
"type": "n8n-nodes-base.n8n",
"position": [
1740,
-100
],
"parameters": {
"operation": "create",
"requestOptions": {},
"workflowObject": "={{ $json.toJsonString() }}"
},
"credentials": {
"n8nApi": {
"id": "f2iSnAHCaePA8jyU",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "4092e6aa-183f-4f9e-ae77-8784e9817d5c",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-200,
-580
],
"parameters": {
"width": 420,
"height": 320,
"content": "## 设置"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {
"Github Trigger - When there is new pull request": [
{
"json": {
"body": {
"action": "closed",
"number": 15,
"sender": {
"id": 10395393,
"url": "https://api.github.com/users/duynb92",
"type": "User",
"login": "duynb92",
"node_id": "MDQ6VXNlcjEwMzk1Mzkz",
"html_url": "https://github.com/duynb92",
"gists_url": "https://api.github.com/users/duynb92/gists{/gist_id}",
"repos_url": "https://api.github.com/users/duynb92/repos",
"avatar_url": "https://avatars.githubusercontent.com/u/10395393?v=4",
"events_url": "https://api.github.com/users/duynb92/events{/privacy}",
"site_admin": false,
"gravatar_id": "",
"starred_url": "https://api.github.com/users/duynb92/starred{/owner}{/repo}",
"followers_url": "https://api.github.com/users/duynb92/followers",
"following_url": "https://api.github.com/users/duynb92/following{/other_user}",
"user_view_type": "public",
"organizations_url": "https://api.github.com/users/duynb92/orgs",
"subscriptions_url": "https://api.github.com/users/duynb92/subscriptions",
"received_events_url": "https://api.github.com/users/duynb92/received_events"
},
"repository": {
"id": 990786394,
"url": "https://api.github.com/repos/duynb92/n8n-workflows",
"fork": false,
"name": "n8n-workflows",
"size": 53,
"forks": 0,
"owner": {
"id": 10395393,
"url": "https://api.github.com/users/duynb92",
"type": "User",
"login": "duynb92",
"node_id": "MDQ6VXNlcjEwMzk1Mzkz",
"html_url": "https://github.com/duynb92",
"gists_url": "https://api.github.com/users/duynb92/gists{/gist_id}",
"repos_url": "https://api.github.com/users/duynb92/repos",
"avatar_url": "https://avatars.githubusercontent.com/u/10395393?v=4",
"events_url": "https://api.github.com/users/duynb92/events{/privacy}",
"site_admin": false,
"gravatar_id": "",
"starred_url": "https://api.github.com/users/duynb92/starred{/owner}{/repo}",
"followers_url": "https://api.github.com/users/duynb92/followers",
"following_url": "https://api.github.com/users/duynb92/following{/other_user}",
"user_view_type": "public",
"organizations_url": "https://api.github.com/users/duynb92/orgs",
"subscriptions_url": "https://api.github.com/users/duynb92/subscriptions",
"received_events_url": "https://api.github.com/users/duynb92/received_events"
},
"topics": [],
"git_url": "git://github.com/duynb92/n8n-workflows.git",
"license": {
"key": "mit",
"url": "https://api.github.com/licenses/mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT"
},
"node_id": "R_kgDOOw4zWg",
"private": true,
"ssh_url": "git@github.com:duynb92/n8n-workflows.git",
"svn_url": "https://github.com/duynb92/n8n-workflows",
"archived": false,
"disabled": false,
"has_wiki": false,
"homepage": null,
"html_url": "https://github.com/duynb92/n8n-workflows",
"keys_url": "https://api.github.com/repos/duynb92/n8n-workflows/keys{/key_id}",
"language": null,
"tags_url": "https://api.github.com/repos/duynb92/n8n-workflows/tags",
"watchers": 0,
"blobs_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/blobs{/sha}",
"clone_url": "https://github.com/duynb92/n8n-workflows.git",
"forks_url": "https://api.github.com/repos/duynb92/n8n-workflows/forks",
"full_name": "duynb92/n8n-workflows",
"has_pages": false,
"hooks_url": "https://api.github.com/repos/duynb92/n8n-workflows/hooks",
"pulls_url": "https://api.github.com/repos/duynb92/n8n-workflows/pulls{/number}",
"pushed_at": "2025-05-28T14:56:45Z",
"teams_url": "https://api.github.com/repos/duynb92/n8n-workflows/teams",
"trees_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/trees{/sha}",
"created_at": "2025-05-26T16:24:14Z",
"events_url": "https://api.github.com/repos/duynb92/n8n-workflows/events",
"has_issues": true,
"issues_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues{/number}",
"labels_url": "https://api.github.com/repos/duynb92/n8n-workflows/labels{/name}",
"merges_url": "https://api.github.com/repos/duynb92/n8n-workflows/merges",
"mirror_url": null,
"updated_at": "2025-05-27T16:55:41Z",
"visibility": "private",
"archive_url": "https://api.github.com/repos/duynb92/n8n-workflows/{archive_format}{/ref}",
"commits_url": "https://api.github.com/repos/duynb92/n8n-workflows/commits{/sha}",
"compare_url": "https://api.github.com/repos/duynb92/n8n-workflows/compare/{base}...{head}",
"description": null,
"forks_count": 0,
"is_template": false,
"open_issues": 0,
"branches_url": "https://api.github.com/repos/duynb92/n8n-workflows/branches{/branch}",
"comments_url": "https://api.github.com/repos/duynb92/n8n-workflows/comments{/number}",
"contents_url": "https://api.github.com/repos/duynb92/n8n-workflows/contents/{+path}",
"git_refs_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/tags{/sha}",
"has_projects": true,
"releases_url": "https://api.github.com/repos/duynb92/n8n-workflows/releases{/id}",
"statuses_url": "https://api.github.com/repos/duynb92/n8n-workflows/statuses/{sha}",
"allow_forking": true,
"assignees_url": "https://api.github.com/repos/duynb92/n8n-workflows/assignees{/user}",
"downloads_url": "https://api.github.com/repos/duynb92/n8n-workflows/downloads",
"has_downloads": true,
"languages_url": "https://api.github.com/repos/duynb92/n8n-workflows/languages",
"default_branch": "main",
"milestones_url": "https://api.github.com/repos/duynb92/n8n-workflows/milestones{/number}",
"stargazers_url": "https://api.github.com/repos/duynb92/n8n-workflows/stargazers",
"watchers_count": 0,
"deployments_url": "https://api.github.com/repos/duynb92/n8n-workflows/deployments",
"git_commits_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/commits{/sha}",
"has_discussions": false,
"subscribers_url": "https://api.github.com/repos/duynb92/n8n-workflows/subscribers",
"contributors_url": "https://api.github.com/repos/duynb92/n8n-workflows/contributors",
"issue_events_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues/events{/number}",
"stargazers_count": 0,
"subscription_url": "https://api.github.com/repos/duynb92/n8n-workflows/subscription",
"collaborators_url": "https://api.github.com/repos/duynb92/n8n-workflows/collaborators{/collaborator}",
"issue_comment_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues/comments{/number}",
"notifications_url": "https://api.github.com/repos/duynb92/n8n-workflows/notifications{?since,all,participating}",
"open_issues_count": 0,
"web_commit_signoff_required": false
},
"pull_request": {
"id": 2549822579,
"url": "https://api.github.com/repos/duynb92/n8n-workflows/pulls/15",
"base": {
"ref": "main",
"sha": "ed692330f94f6a25f525d575a2717e2873759b89",
"repo": {
"id": 990786394,
"url": "https://api.github.com/repos/duynb92/n8n-workflows",
"fork": false,
"name": "n8n-workflows",
"size": 53,
"forks": 0,
"owner": {
"id": 10395393,
"url": "https://api.github.com/users/duynb92",
"type": "User",
"login": "duynb92",
"node_id": "MDQ6VXNlcjEwMzk1Mzkz",
"html_url": "https://github.com/duynb92",
"gists_url": "https://api.github.com/users/duynb92/gists{/gist_id}",
"repos_url": "https://api.github.com/users/duynb92/repos",
"avatar_url": "https://avatars.githubusercontent.com/u/10395393?v=4",
"events_url": "https://api.github.com/users/duynb92/events{/privacy}",
"site_admin": false,
"gravatar_id": "",
"starred_url": "https://api.github.com/users/duynb92/starred{/owner}{/repo}",
"followers_url": "https://api.github.com/users/duynb92/followers",
"following_url": "https://api.github.com/users/duynb92/following{/other_user}",
"user_view_type": "public",
"organizations_url": "https://api.github.com/users/duynb92/orgs",
"subscriptions_url": "https://api.github.com/users/duynb92/subscriptions",
"received_events_url": "https://api.github.com/users/duynb92/received_events"
},
"topics": [],
"git_url": "git://github.com/duynb92/n8n-workflows.git",
"license": {
"key": "mit",
"url": "https://api.github.com/licenses/mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT"
},
"node_id": "R_kgDOOw4zWg",
"private": true,
"ssh_url": "git@github.com:duynb92/n8n-workflows.git",
"svn_url": "https://github.com/duynb92/n8n-workflows",
"archived": false,
"disabled": false,
"has_wiki": false,
"homepage": null,
"html_url": "https://github.com/duynb92/n8n-workflows",
"keys_url": "https://api.github.com/repos/duynb92/n8n-workflows/keys{/key_id}",
"language": null,
"tags_url": "https://api.github.com/repos/duynb92/n8n-workflows/tags",
"watchers": 0,
"blobs_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/blobs{/sha}",
"clone_url": "https://github.com/duynb92/n8n-workflows.git",
"forks_url": "https://api.github.com/repos/duynb92/n8n-workflows/forks",
"full_name": "duynb92/n8n-workflows",
"has_pages": false,
"hooks_url": "https://api.github.com/repos/duynb92/n8n-workflows/hooks",
"pulls_url": "https://api.github.com/repos/duynb92/n8n-workflows/pulls{/number}",
"pushed_at": "2025-05-28T14:56:45Z",
"teams_url": "https://api.github.com/repos/duynb92/n8n-workflows/teams",
"trees_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/trees{/sha}",
"created_at": "2025-05-26T16:24:14Z",
"events_url": "https://api.github.com/repos/duynb92/n8n-workflows/events",
"has_issues": true,
"issues_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues{/number}",
"labels_url": "https://api.github.com/repos/duynb92/n8n-workflows/labels{/name}",
"merges_url": "https://api.github.com/repos/duynb92/n8n-workflows/merges",
"mirror_url": null,
"updated_at": "2025-05-27T16:55:41Z",
"visibility": "private",
"archive_url": "https://api.github.com/repos/duynb92/n8n-workflows/{archive_format}{/ref}",
"commits_url": "https://api.github.com/repos/duynb92/n8n-workflows/commits{/sha}",
"compare_url": "https://api.github.com/repos/duynb92/n8n-workflows/compare/{base}...{head}",
"description": null,
"forks_count": 0,
"is_template": false,
"open_issues": 0,
"branches_url": "https://api.github.com/repos/duynb92/n8n-workflows/branches{/branch}",
"comments_url": "https://api.github.com/repos/duynb92/n8n-workflows/comments{/number}",
"contents_url": "https://api.github.com/repos/duynb92/n8n-workflows/contents/{+path}",
"git_refs_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/tags{/sha}",
"has_projects": true,
"releases_url": "https://api.github.com/repos/duynb92/n8n-workflows/releases{/id}",
"statuses_url": "https://api.github.com/repos/duynb92/n8n-workflows/statuses/{sha}",
"allow_forking": true,
"assignees_url": "https://api.github.com/repos/duynb92/n8n-workflows/assignees{/user}",
"downloads_url": "https://api.github.com/repos/duynb92/n8n-workflows/downloads",
"has_downloads": true,
"languages_url": "https://api.github.com/repos/duynb92/n8n-workflows/languages",
"default_branch": "main",
"milestones_url": "https://api.github.com/repos/duynb92/n8n-workflows/milestones{/number}",
"stargazers_url": "https://api.github.com/repos/duynb92/n8n-workflows/stargazers",
"watchers_count": 0,
"deployments_url": "https://api.github.com/repos/duynb92/n8n-workflows/deployments",
"git_commits_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/commits{/sha}",
"has_discussions": false,
"subscribers_url": "https://api.github.com/repos/duynb92/n8n-workflows/subscribers",
"allow_auto_merge": false,
"contributors_url": "https://api.github.com/repos/duynb92/n8n-workflows/contributors",
"issue_events_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues/events{/number}",
"stargazers_count": 0,
"subscription_url": "https://api.github.com/repos/duynb92/n8n-workflows/subscription",
"collaborators_url": "https://api.github.com/repos/duynb92/n8n-workflows/collaborators{/collaborator}",
"issue_comment_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues/comments{/number}",
"notifications_url": "https://api.github.com/repos/duynb92/n8n-workflows/notifications{?since,all,participating}",
"open_issues_count": 0,
"allow_merge_commit": true,
"allow_rebase_merge": true,
"allow_squash_merge": true,
"merge_commit_title": "MERGE_MESSAGE",
"allow_update_branch": false,
"merge_commit_message": "PR_TITLE",
"delete_branch_on_merge": true,
"squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
"squash_merge_commit_message": "COMMIT_MESSAGES",
"web_commit_signoff_required": false,
"use_squash_pr_title_as_default": false
},
"user": {
"id": 10395393,
"url": "https://api.github.com/users/duynb92",
"type": "User",
"login": "duynb92",
"node_id": "MDQ6VXNlcjEwMzk1Mzkz",
"html_url": "https://github.com/duynb92",
"gists_url": "https://api.github.com/users/duynb92/gists{/gist_id}",
"repos_url": "https://api.github.com/users/duynb92/repos",
"avatar_url": "https://avatars.githubusercontent.com/u/10395393?v=4",
"events_url": "https://api.github.com/users/duynb92/events{/privacy}",
"site_admin": false,
"gravatar_id": "",
"starred_url": "https://api.github.com/users/duynb92/starred{/owner}{/repo}",
"followers_url": "https://api.github.com/users/duynb92/followers",
"following_url": "https://api.github.com/users/duynb92/following{/other_user}",
"user_view_type": "public",
"organizations_url": "https://api.github.com/users/duynb92/orgs",
"subscriptions_url": "https://api.github.com/users/duynb92/subscriptions",
"received_events_url": "https://api.github.com/users/duynb92/received_events"
},
"label": "duynb92:main"
},
"body": null,
"head": {
"ref": "workflows_2025-05-28-09-56-29",
"sha": "e886ae1e4b8cbcee88cd1a755e1047dd54061d09",
"repo": {
"id": 990786394,
"url": "https://api.github.com/repos/duynb92/n8n-workflows",
"fork": false,
"name": "n8n-workflows",
"size": 53,
"forks": 0,
"owner": {
"id": 10395393,
"url": "https://api.github.com/users/duynb92",
"type": "User",
"login": "duynb92",
"node_id": "MDQ6VXNlcjEwMzk1Mzkz",
"html_url": "https://github.com/duynb92",
"gists_url": "https://api.github.com/users/duynb92/gists{/gist_id}",
"repos_url": "https://api.github.com/users/duynb92/repos",
"avatar_url": "https://avatars.githubusercontent.com/u/10395393?v=4",
"events_url": "https://api.github.com/users/duynb92/events{/privacy}",
"site_admin": false,
"gravatar_id": "",
"starred_url": "https://api.github.com/users/duynb92/starred{/owner}{/repo}",
"followers_url": "https://api.github.com/users/duynb92/followers",
"following_url": "https://api.github.com/users/duynb92/following{/other_user}",
"user_view_type": "public",
"organizations_url": "https://api.github.com/users/duynb92/orgs",
"subscriptions_url": "https://api.github.com/users/duynb92/subscriptions",
"received_events_url": "https://api.github.com/users/duynb92/received_events"
},
"topics": [],
"git_url": "git://github.com/duynb92/n8n-workflows.git",
"license": {
"key": "mit",
"url": "https://api.github.com/licenses/mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT"
},
"node_id": "R_kgDOOw4zWg",
"private": true,
"ssh_url": "git@github.com:duynb92/n8n-workflows.git",
"svn_url": "https://github.com/duynb92/n8n-workflows",
"archived": false,
"disabled": false,
"has_wiki": false,
"homepage": null,
"html_url": "https://github.com/duynb92/n8n-workflows",
"keys_url": "https://api.github.com/repos/duynb92/n8n-workflows/keys{/key_id}",
"language": null,
"tags_url": "https://api.github.com/repos/duynb92/n8n-workflows/tags",
"watchers": 0,
"blobs_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/blobs{/sha}",
"clone_url": "https://github.com/duynb92/n8n-workflows.git",
"forks_url": "https://api.github.com/repos/duynb92/n8n-workflows/forks",
"full_name": "duynb92/n8n-workflows",
"has_pages": false,
"hooks_url": "https://api.github.com/repos/duynb92/n8n-workflows/hooks",
"pulls_url": "https://api.github.com/repos/duynb92/n8n-workflows/pulls{/number}",
"pushed_at": "2025-05-28T14:56:45Z",
"teams_url": "https://api.github.com/repos/duynb92/n8n-workflows/teams",
"trees_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/trees{/sha}",
"created_at": "2025-05-26T16:24:14Z",
"events_url": "https://api.github.com/repos/duynb92/n8n-workflows/events",
"has_issues": true,
"issues_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues{/number}",
"labels_url": "https://api.github.com/repos/duynb92/n8n-workflows/labels{/name}",
"merges_url": "https://api.github.com/repos/duynb92/n8n-workflows/merges",
"mirror_url": null,
"updated_at": "2025-05-27T16:55:41Z",
"visibility": "private",
"archive_url": "https://api.github.com/repos/duynb92/n8n-workflows/{archive_format}{/ref}",
"commits_url": "https://api.github.com/repos/duynb92/n8n-workflows/commits{/sha}",
"compare_url": "https://api.github.com/repos/duynb92/n8n-workflows/compare/{base}...{head}",
"description": null,
"forks_count": 0,
"is_template": false,
"open_issues": 0,
"branches_url": "https://api.github.com/repos/duynb92/n8n-workflows/branches{/branch}",
"comments_url": "https://api.github.com/repos/duynb92/n8n-workflows/comments{/number}",
"contents_url": "https://api.github.com/repos/duynb92/n8n-workflows/contents/{+path}",
"git_refs_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/tags{/sha}",
"has_projects": true,
"releases_url": "https://api.github.com/repos/duynb92/n8n-workflows/releases{/id}",
"statuses_url": "https://api.github.com/repos/duynb92/n8n-workflows/statuses/{sha}",
"allow_forking": true,
"assignees_url": "https://api.github.com/repos/duynb92/n8n-workflows/assignees{/user}",
"downloads_url": "https://api.github.com/repos/duynb92/n8n-workflows/downloads",
"has_downloads": true,
"languages_url": "https://api.github.com/repos/duynb92/n8n-workflows/languages",
"default_branch": "main",
"milestones_url": "https://api.github.com/repos/duynb92/n8n-workflows/milestones{/number}",
"stargazers_url": "https://api.github.com/repos/duynb92/n8n-workflows/stargazers",
"watchers_count": 0,
"deployments_url": "https://api.github.com/repos/duynb92/n8n-workflows/deployments",
"git_commits_url": "https://api.github.com/repos/duynb92/n8n-workflows/git/commits{/sha}",
"has_discussions": false,
"subscribers_url": "https://api.github.com/repos/duynb92/n8n-workflows/subscribers",
"allow_auto_merge": false,
"contributors_url": "https://api.github.com/repos/duynb92/n8n-workflows/contributors",
"issue_events_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues/events{/number}",
"stargazers_count": 0,
"subscription_url": "https://api.github.com/repos/duynb92/n8n-workflows/subscription",
"collaborators_url": "https://api.github.com/repos/duynb92/n8n-workflows/collaborators{/collaborator}",
"issue_comment_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues/comments{/number}",
"notifications_url": "https://api.github.com/repos/duynb92/n8n-workflows/notifications{?since,all,participating}",
"open_issues_count": 0,
"allow_merge_commit": true,
"allow_rebase_merge": true,
"allow_squash_merge": true,
"merge_commit_title": "MERGE_MESSAGE",
"allow_update_branch": false,
"merge_commit_message": "PR_TITLE",
"delete_branch_on_merge": true,
"squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
"squash_merge_commit_message": "COMMIT_MESSAGES",
"web_commit_signoff_required": false,
"use_squash_pr_title_as_default": false
},
"user": {
"id": 10395393,
"url": "https://api.github.com/users/duynb92",
"type": "User",
"login": "duynb92",
"node_id": "MDQ6VXNlcjEwMzk1Mzkz",
"html_url": "https://github.com/duynb92",
"gists_url": "https://api.github.com/users/duynb92/gists{/gist_id}",
"repos_url": "https://api.github.com/users/duynb92/repos",
"avatar_url": "https://avatars.githubusercontent.com/u/10395393?v=4",
"events_url": "https://api.github.com/users/duynb92/events{/privacy}",
"site_admin": false,
"gravatar_id": "",
"starred_url": "https://api.github.com/users/duynb92/starred{/owner}{/repo}",
"followers_url": "https://api.github.com/users/duynb92/followers",
"following_url": "https://api.github.com/users/duynb92/following{/other_user}",
"user_view_type": "public",
"organizations_url": "https://api.github.com/users/duynb92/orgs",
"subscriptions_url": "https://api.github.com/users/duynb92/subscriptions",
"received_events_url": "https://api.github.com/users/duynb92/received_events"
},
"label": "duynb92:workflows_2025-05-28-09-56-29"
},
"user": {
"id": 10395393,
"url": "https://api.github.com/users/duynb92",
"type": "User",
"login": "duynb92",
"node_id": "MDQ6VXNlcjEwMzk1Mzkz",
"html_url": "https://github.com/duynb92",
"gists_url": "https://api.github.com/users/duynb92/gists{/gist_id}",
"repos_url": "https://api.github.com/users/duynb92/repos",
"avatar_url": "https://avatars.githubusercontent.com/u/10395393?v=4",
"events_url": "https://api.github.com/users/duynb92/events{/privacy}",
"site_admin": false,
"gravatar_id": "",
"starred_url": "https://api.github.com/users/duynb92/starred{/owner}{/repo}",
"followers_url": "https://api.github.com/users/duynb92/followers",
"following_url": "https://api.github.com/users/duynb92/following{/other_user}",
"user_view_type": "public",
"organizations_url": "https://api.github.com/users/duynb92/orgs",
"subscriptions_url": "https://api.github.com/users/duynb92/subscriptions",
"received_events_url": "https://api.github.com/users/duynb92/received_events"
},
"draft": false,
"state": "closed",
"title": "Automated PR for workflows_2025-05-28-09-56-29",
"_links": {
"html": {
"href": "https://github.com/duynb92/n8n-workflows/pull/15"
},
"self": {
"href": "https://api.github.com/repos/duynb92/n8n-workflows/pulls/15"
},
"issue": {
"href": "https://api.github.com/repos/duynb92/n8n-workflows/issues/15"
},
"commits": {
"href": "https://api.github.com/repos/duynb92/n8n-workflows/pulls/15/commits"
},
"comments": {
"href": "https://api.github.com/repos/duynb92/n8n-workflows/issues/15/comments"
},
"statuses": {
"href": "https://api.github.com/repos/duynb92/n8n-workflows/statuses/e886ae1e4b8cbcee88cd1a755e1047dd54061d09"
},
"review_comment": {
"href": "https://api.github.com/repos/duynb92/n8n-workflows/pulls/comments{/number}"
},
"review_comments": {
"href": "https://api.github.com/repos/duynb92/n8n-workflows/pulls/15/comments"
}
},
"labels": [],
"locked": false,
"merged": true,
"number": 15,
"commits": 3,
"node_id": "PR_kwDOOw4zWs6X-zRz",
"assignee": null,
"comments": 0,
"diff_url": "https://github.com/duynb92/n8n-workflows/pull/15.diff",
"html_url": "https://github.com/duynb92/n8n-workflows/pull/15",
"additions": 2,
"assignees": [],
"closed_at": "2025-05-28T14:57:54Z",
"deletions": 1,
"issue_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues/15",
"mergeable": null,
"merged_at": "2025-05-28T14:57:54Z",
"merged_by": {
"id": 10395393,
"url": "https://api.github.com/users/duynb92",
"type": "User",
"login": "duynb92",
"node_id": "MDQ6VXNlcjEwMzk1Mzkz",
"html_url": "https://github.com/duynb92",
"gists_url": "https://api.github.com/users/duynb92/gists{/gist_id}",
"repos_url": "https://api.github.com/users/duynb92/repos",
"avatar_url": "https://avatars.githubusercontent.com/u/10395393?v=4",
"events_url": "https://api.github.com/users/duynb92/events{/privacy}",
"site_admin": false,
"gravatar_id": "",
"starred_url": "https://api.github.com/users/duynb92/starred{/owner}{/repo}",
"followers_url": "https://api.github.com/users/duynb92/followers",
"following_url": "https://api.github.com/users/duynb92/following{/other_user}",
"user_view_type": "public",
"organizations_url": "https://api.github.com/users/duynb92/orgs",
"subscriptions_url": "https://api.github.com/users/duynb92/subscriptions",
"received_events_url": "https://api.github.com/users/duynb92/received_events"
},
"milestone": null,
"patch_url": "https://github.com/duynb92/n8n-workflows/pull/15.patch",
"auto_merge": null,
"created_at": "2025-05-28T14:56:45Z",
"rebaseable": null,
"updated_at": "2025-05-28T14:57:54Z",
"commits_url": "https://api.github.com/repos/duynb92/n8n-workflows/pulls/15/commits",
"comments_url": "https://api.github.com/repos/duynb92/n8n-workflows/issues/15/comments",
"statuses_url": "https://api.github.com/repos/duynb92/n8n-workflows/statuses/e886ae1e4b8cbcee88cd1a755e1047dd54061d09",
"changed_files": 2,
"mergeable_state": "unknown",
"requested_teams": [],
"review_comments": 0,
"merge_commit_sha": "ede7bda7aa8d86ff2b7593eb56300a924787315b",
"active_lock_reason": null,
"author_association": "OWNER",
"review_comment_url": "https://api.github.com/repos/duynb92/n8n-workflows/pulls/comments{/number}",
"requested_reviewers": [],
"review_comments_url": "https://api.github.com/repos/duynb92/n8n-workflows/pulls/15/comments",
"maintainer_can_modify": false
}
},
"query": {},
"headers": {
"host": "workflows.agileops.dev",
"accept": "*/*",
"cf-ray": "946e9b701da87faa-IAD",
"cdn-loop": "cloudflare; loops=1",
"cf-visitor": "{\"scheme\":\"https\"}",
"connection": "keep-alive",
"user-agent": "GitHub-Hookshot/e2f7ff6",
"cf-ipcountry": "US",
"content-type": "application/json",
"cf-warp-tag-id": "df66551b-d6a2-4652-80d0-05d5dbb8fa3f",
"content-length": "23394",
"x-github-event": "pull_request",
"accept-encoding": "gzip, br",
"x-forwarded-for": "140.82.115.25",
"cf-connecting-ip": "140.82.115.25",
"x-github-hook-id": "549091902",
"x-forwarded-proto": "https",
"x-github-delivery": "225de610-3bd4-11f0-8d5b-73eeea44cfea",
"x-github-hook-installation-target-id": "990786394",
"x-github-hook-installation-target-type": "repository"
}
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "f6e5573a-f754-4e54-8e78-792b68df4162",
"connections": {
"Define Local Variables": {
"main": [
[
{
"node": "Check if trigger event is pull request merged",
"type": "main",
"index": 0
}
]
]
},
"Filter created workflows": {
"main": [
[
{
"node": "Fetch workflow content from Git",
"type": "main",
"index": 0
}
]
]
},
"Filter modified workflows": {
"main": [
[
{
"node": "Fetch workflow content from Git1",
"type": "main",
"index": 0
}
]
]
},
"Get files changes details": {
"main": [
[
{
"node": "Filter modified workflows",
"type": "main",
"index": 0
},
{
"node": "Filter created workflows",
"type": "main",
"index": 0
}
]
]
},
"Decode workflow content to json": {
"main": [
[
{
"node": "Update workflow in n8n",
"type": "main",
"index": 0
}
]
]
},
"Fetch workflow content from Git": {
"main": [
[
{
"node": "Decode workflow content to json1",
"type": "main",
"index": 0
}
]
]
},
"Decode workflow content to json1": {
"main": [
[
{
"node": "Create new workflow in n8n",
"type": "main",
"index": 0
}
]
]
},
"Fetch workflow content from Git1": {
"main": [
[
{
"node": "Decode workflow content to json",
"type": "main",
"index": 0
}
]
]
},
"Fetch merged commit details via GitHub API": {
"main": [
[
{
"node": "Get files changes details",
"type": "main",
"index": 0
}
]
]
},
"Check if trigger event is pull request merged": {
"main": [
[
{
"node": "Fetch merged commit details via GitHub API",
"type": "main",
"index": 0
}
]
]
},
"Github Trigger - When there is new pull request": {
"main": [
[
{
"node": "Define Local Variables",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 开发运维, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
工作流备份至 GitHub
自动化工作流备份至 GitHub,包含 PR 创建和 Slack 通知
If
N8n
Set
+8
23 节点Bao Duy Nguyen
开发运维
GitHub 同步仪表板 - V2
具有提交历史和回滚功能的 GitHub 工作流版本控制仪表板
If
N8n
Set
+20
94 节点Eduard
开发运维
将您的工作流保存到 GitHub 仓库
每日工作流备份至 GitHub 并发送 Slack 通知
If
N8n
Set
+10
18 节点Andrew
开发运维
INST安装程序
打包部署多个n8n工作流 - 含自动凭证映射
If
N8n
Set
+12
31 节点Wyeth
开发运维
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
其他