fix(n8n): self-healing — задачи в рабочий репозиторий, условие v2, ветка ложь

This commit is contained in:
root committed 2026-10-14 11:36:41 +03:00
1 parent 72f96a2bcc
commit a8eefb63c1
1 file changed
+110 -109
+110 -109
View File
@@ -2,88 +2,76 @@
{
"id": "TSqu00NJx2JOrtoN",
"name": "Uptime Kuma → Gitea Self-Healing",
"description": null,
"active": true,
"createdAt": "2026-09-11T12:37:51.879Z",
"updatedAt": "2026-09-25T07:26:21.344Z",
"isArchived": false,
"sourceWorkflowId": null,
"triggerCount": 1,
"active": false,
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "uptime-kuma",
"responseMode": "responseNode",
"options": {}
},
"name": "Uptime Kuma Webhook",
"webhookId": "95de5809-c2a6-4ba1-a472-89debbc46fbb",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
256,
304
144,
256
],
"parameters": {
"path": "uptime-kuma",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"id": "3d7a7e98-5b78-4709-9474-1e10bae2469b"
"id": "a4c37fdc-fe82-4d53-8cd9-0d6af7afc90f"
},
{
"parameters": {
"jsCode": "const webhookData = $input.first().json;\nconst body = webhookData.body || webhookData;\n\n// УМНАЯ ПРОВЕРКА: если monitor_name пуст или 'Unknown', берем домен из URL\nlet monitorName = body.monitor_name || 'Unknown';\nif (monitorName === 'Unknown' || !monitorName) {\n const url = body.monitor_url || '';\n monitorName = url ? url.replace(/https?:\\/\\//, '').split('/')[0] : 'Unknown Service';\n}\n\nconst monitorUrl = body.monitor_url || 'N/A';\nconst status = parseInt(body.heartbeat_status) || 0;\nconst message = body.heartbeat_message || 'Service is down';\n\nconst ctMatch = monitorName.match(/\\((\\d+)\\)/);\nconst ctId = ctMatch ? ctMatch[1] : null;\n\n// Создаем четкий заголовок для Gitea\nconst giteaTitle = `AUTO-FIX: ${monitorName} DOWN`;\n\nreturn [{\n json: {\n monitorName,\n monitorUrl,\n status,\n message,\n ctId,\n giteaTitle,\n timestamp: new Date().toISOString(),\n shouldAlert: status === 0 && ctId !== null\n }\n}];"
},
"name": "Extract Info",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
480,
304
368,
256
],
"parameters": {
"jsCode": "const webhookData = $input.first().json;\nconst body = webhookData.body || webhookData;\n\nconst monitorName = body.monitor_name || 'Unknown';\nconst monitorUrl = body.monitor_url || '';\nconst status = parseInt(body.heartbeat_status) || 0;\nconst message = body.heartbeat_message || 'Service is down';\n\nconst ctMatch = monitorName.match(/\\((\\d+)\\)/);\nconst ctId = ctMatch ? ctMatch[1] : null;\n\nreturn [{\n json: {\n monitorName,\n monitorUrl,\n status,\n message,\n ctId,\n timestamp: new Date().toISOString(),\n shouldAlert: status === 0 && ctId !== null\n }\n}];"
},
"id": "49a459f5-1b1e-4bd6-83d9-b231a7d018c6"
"id": "23e46b7d-28db-4d26-b90b-f86f49d216bc"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "b1e6f2a0-1111-4222-8333-444455556666",
"leftValue": "={{ $json.shouldAlert }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"name": "Should Create Issue?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
720,
304
608,
256
],
"parameters": {
"options": {},
"conditions": {
"boolean": [
{
"value1": "={{ $json.shouldAlert }}",
"value2": true
}
],
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and"
}
},
"id": "a5a56bde-cd3c-404c-959d-5eb4cf344f80"
"id": "2b7f557f-8d80-4266-8f67-6b1dc3c38f25"
},
{
"name": "Create Gitea Issue",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
944,
208
],
"parameters": {
"url": "http://192.168.1.140:3000/api/v1/repos/root/buryan-hub/issues",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({ title: \"AUTO-FIX: \" + $json.monitorName + \" DOWN\", body: \"CT_DOWN:\" + $json.ctId + \"\\n\\nАвтоматическое восстановление \" + $json.monitorName + \".\\n\\nURL: \" + $json.monitorUrl + \"\\nMessage: \" + $json.message + \"\\nTime: \" + $json.timestamp, labels: [2] }) }}",
"sendBody": true,
"url": "http://192.168.1.140:3000/api/v1/repos/agent-qwen/buryan-infra/issues",
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
@@ -95,34 +83,22 @@
"value": "application/json"
}
]
}
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ title: $json.giteaTitle, body: \"CT_DOWN: \" + $json.ctId + \"\\n\\nАвтоматическое восстановление: \" + $json.monitorName + \".\\n\\nURL: \" + $json.monitorUrl + \"\\nMessage: \" + $json.message + \"\\nTime: \" + $json.timestamp, labels: [2] }) }}",
"options": {}
},
"id": "ffc579ec-a0cf-41d4-9444-66fc9af71bfb"
},
{
"name": "Respond",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1184,
208
],
"parameters": {
"options": {},
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ ok: true, issue_created: $json.html_url || null }) }}"
},
"id": "b7050fd1-a247-4b50-846d-4358e7073e89"
},
{
"id": "06142831-0672-469e-898e-79463b84f3db",
"name": "Notify Telegram",
"name": "Create Gitea Issue",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1200,
304
832,
160
],
"id": "40bcfe34-b905-4ab2-ac2d-5de5ad5e9d5b"
},
{
"parameters": {
"method": "POST",
"url": "https://193.233.210.184/tg-api/bot8668603602:AAHVmUmq44dcomw8QOfw_qj1aICXuT5c5XU/sendMessage",
@@ -144,7 +120,7 @@
},
{
"name": "text",
"value": "=🚨 {{ $json.monitorName }} DOWN\n\nURL: {{ $json.monitorUrl }}\nВремя: {{ new Date().toLocaleString(\"ru-RU\") }}\n\nIssue создан в Gitea"
"value": "=🚨 <b>{{ $json.monitorName }}</b> DOWN\n\nURL: {{ $json.monitorUrl }}\nВремя: {{ new Date().toLocaleString(\"ru-RU\") }}\n\n✅ Issue создан в Gitea: {{ $json.giteaTitle }}"
},
{
"name": "parse_mode",
@@ -154,34 +130,34 @@
},
"options": {
"allowUnauthorizedCerts": true
},
"proxy": "http://193.233.210.184:1080"
}
}
},
"name": "Notify Telegram",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1088,
256
],
"id": "9cbd83b9-944f-4d3f-9803-62ccf51cd458"
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ ok: true, issue_created: $json.html_url || null }) }}",
"options": {}
},
"name": "Respond",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1312,
256
],
"id": "6eac3128-5c63-4315-89af-4fb0be610522"
}
],
"connections": {
"Extract Info": {
"main": [
[
{
"node": "Should Create Issue?",
"type": "main",
"index": 0
}
]
]
},
"Create Gitea Issue": {
"main": [
[
{
"node": "Notify Telegram",
"type": "main",
"index": 0
}
]
]
},
"Uptime Kuma Webhook": {
"main": [
[
@@ -193,6 +169,17 @@
]
]
},
"Extract Info": {
"main": [
[
{
"node": "Should Create Issue?",
"type": "main",
"index": 0
}
]
]
},
"Should Create Issue?": {
"main": [
[
@@ -201,6 +188,24 @@
"type": "main",
"index": 0
}
],
[
{
"node": "Respond",
"type": "main",
"index": 0
}
]
]
},
"Create Gitea Issue": {
"main": [
[
{
"node": "Notify Telegram",
"type": "main",
"index": 0
}
]
]
},
@@ -216,14 +221,10 @@
]
}
},
"nodeGroups": [],
"settings": {
"binaryMode": "separate",
"executionOrder": "v1"
},
"staticData": null,
"pinData": {},
"meta": null,
"tags": []
"staticData": null
}
]