从GitLab群组到Gitea组织的自动化仓库迁移
中级
这是一个Engineering领域的自动化工作流,包含 8 个节点。主要使用 Set, Switch, HttpRequest, StopAndError, ManualTrigger 等节点。 从GitLab群组到Gitea组织的自动化仓库迁移
前置要求
- •可能需要目标 API 的认证凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "ac1706f2-273e-4191-94f7-0e4c84e6939b",
"name": "当点击“执行工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
140,
-20
],
"parameters": {},
"typeVersion": 1
},
{
"id": "93d54a8a-9a7c-4193-89b6-754014b804d5",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
800,
-20
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "ac8b47d9-ba45-42c0-be51-2a9ecf2cada6",
"name": "切换错误代码",
"type": "n8n-nodes-base.switch",
"position": [
1260,
-20
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "404",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1d1c97aa-61cd-4272-a650-a70c04dea44b",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": "={{ $json.error.status }}",
"rightValue": 404
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.2
},
{
"id": "cf3bee67-e127-4efb-a8b1-384603eb0151",
"name": "停止并报错",
"type": "n8n-nodes-base.stopAndError",
"position": [
1500,
200
],
"parameters": {
"errorMessage": "Unexpected error code when checking if Gitea repo already exists"
},
"typeVersion": 1
},
{
"id": "8e3e60c7-a555-45aa-8ff4-aa64fd3aec46",
"name": "设置(请修改)",
"type": "n8n-nodes-base.set",
"position": [
360,
-20
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "3a089155-3799-416c-bdc6-2d8db2c093d5",
"name": "gitlabAccessToken",
"type": "string",
"value": "1234567890"
},
{
"id": "1da58875-baa0-4a4a-86e8-6294236b21e1",
"name": "gitlabGroupPathName",
"type": "string",
"value": "gitlab-group-name"
},
{
"id": "ec12a90b-5b50-4a19-8e28-84c9d540497c",
"name": "giteaOrganizationPathName",
"type": "string",
"value": "gitea-org-name"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e475bc22-719c-4d87-95ba-7567107b7ecd",
"name": "Gitea:迁移仓库",
"type": "n8n-nodes-base.httpRequest",
"position": [
1500,
-20
],
"parameters": {
"url": "=https://gitea.example.com/api/v1/repos/migrate",
"method": "POST",
"options": {},
"jsonBody": "={\n \"auth_token\": \"{{ $('Setup (CHANGE ME)').item.json.gitlabAccessToken }}\",\n \"clone_addr\": \"{{ $('Loop Over Items').item.json.http_url_to_repo }}\",\n \"description\": \"{{ $('Loop Over Items').item.json.description }}\",\n \"issues\": true,\n \"labels\": true,\n \"lfs\": true,\n \"milestones\": true,\n \"mirror\": false,\n \"private\": true,\n \"pull_requests\": true,\n \"releases\": true,\n \"repo_name\": \"{{ $('Loop Over Items').item.json.path }}\",\n \"repo_owner\": \"{{ $('Setup (CHANGE ME)').item.json.giteaOrganizationPathName }}\",\n \"service\": \"gitlab\",\n \"wiki\": true\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "CYeYVeqp4akR6yUQ",
"name": "user @ gitea.example.com"
}
},
"typeVersion": 4.2
},
{
"id": "159efdb3-b3a6-469f-8021-b608996ffcc5",
"name": "Gitea:搜索仓库",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueErrorOutput",
"position": [
1040,
-20
],
"parameters": {
"url": "=https://gitea.example.com/api/v1/repos/{{ $('Setup (CHANGE ME)').item.json.giteaOrganizationPathName }}/{{ $json.path }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "CYeYVeqp4akR6yUQ",
"name": "user @ gitea.example.com"
}
},
"typeVersion": 4.2
},
{
"id": "06081af1-73c9-4f61-889c-289ea3de4c2c",
"name": "Gitlab:获取项目",
"type": "n8n-nodes-base.httpRequest",
"position": [
580,
-20
],
"parameters": {
"url": "=https://gitlab.com/api/v4/groups/{{ $json.gitlabGroupPathName }}/projects",
"options": {
"pagination": {
"pagination": {
"parameters": {
"parameters": [
{
"name": "page",
"value": "={{ $response.headers['x-next-page'] }}"
}
]
},
"completeExpression": "={{ $response.headers['x-page'] == $response.headers['x-total-pages'] }}",
"paginationCompleteWhen": "other"
}
}
},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"queryParameters": {
"parameters": [
{
"name": "per_page",
"value": "20"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "G4Myr7VP19BAIaW9",
"name": "user @ gitlab.com"
}
},
"typeVersion": 4.2
}
],
"pinData": {},
"connections": {
"93d54a8a-9a7c-4193-89b6-754014b804d5": {
"main": [
[],
[
{
"node": "159efdb3-b3a6-469f-8021-b608996ffcc5",
"type": "main",
"index": 0
}
]
]
},
"8e3e60c7-a555-45aa-8ff4-aa64fd3aec46": {
"main": [
[
{
"node": "06081af1-73c9-4f61-889c-289ea3de4c2c",
"type": "main",
"index": 0
}
]
]
},
"ac8b47d9-ba45-42c0-be51-2a9ecf2cada6": {
"main": [
[
{
"node": "e475bc22-719c-4d87-95ba-7567107b7ecd",
"type": "main",
"index": 0
}
],
[
{
"node": "cf3bee67-e127-4efb-a8b1-384603eb0151",
"type": "main",
"index": 0
}
]
]
},
"e475bc22-719c-4d87-95ba-7567107b7ecd": {
"main": [
[
{
"node": "93d54a8a-9a7c-4193-89b6-754014b804d5",
"type": "main",
"index": 0
}
]
]
},
"06081af1-73c9-4f61-889c-289ea3de4c2c": {
"main": [
[
{
"node": "93d54a8a-9a7c-4193-89b6-754014b804d5",
"type": "main",
"index": 0
}
]
]
},
"159efdb3-b3a6-469f-8021-b608996ffcc5": {
"main": [
[
{
"node": "93d54a8a-9a7c-4193-89b6-754014b804d5",
"type": "main",
"index": 0
}
],
[
{
"node": "ac8b47d9-ba45-42c0-be51-2a9ecf2cada6",
"type": "main",
"index": 0
}
]
]
},
"ac1706f2-273e-4191-94f7-0e4c84e6939b": {
"main": [
[
{
"node": "8e3e60c7-a555-45aa-8ff4-aa64fd3aec46",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 工程
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI智能助手:与Supabase存储和Google Drive文件对话
AI智能助手:与Supabase存储和Google Drive文件对话
If
Set
Wait
+
If
Set
Wait
62 节点Mark Shcherbakov
工程
API架构提取器
API架构提取器
If
Set
Code
+
If
Set
Code
88 节点Polina Medvedieva
工程
使用n8n绕过Cloudflare Turnstile进行网络爬取
使用2captcha绕过Cloudflare Turnstile进行网络爬取
Set
Code
Wait
+
Set
Code
Wait
18 节点Ludwig
工程
实时 - 使用Gemini和Creatomate自动化病毒式AI视频制作与发布
使用Gemini和Creatomate自动化AI视频创作与多平台发布
Set
Code
Wait
+
Set
Code
Wait
47 节点Intuz
内容创作
与Supabase存储中文件对话的AI智能体
与Supabase存储中文件对话的AI智能体
If
Merge
Switch
+
If
Merge
Switch
33 节点Mark Shcherbakov
工程
支持文本、语音、图像和PDF的AI驱动WhatsApp聊天机器人(RAG)
支持文本、语音、图像和PDF的AI驱动WhatsApp聊天机器人(RAG)
Set
Code
Switch
+
Set
Code
Switch
35 节点NovaNode
工程