Files
buryan-infra/infra/n8n/workflows/gitea-task-dispatcher.json
root d2ecee05bc feat(n8n): workflows-as-code — 4 canonical workflows under Git control
Closes Phase 0 of Foundation & Swarm sprint (#null).

Workflows:
- Buryan Health Monitor (webhook → host_states)
- Alert Queue Processor (cron 15min → Telegram)
- Uptime Kuma Self-Healing (webhook → Gitea issue)
- Gitea Task Dispatcher (webhook → Agent Swarm)

All workflows cleaned (del shared/activeVersion/versionId) for portability.

Ref: MASTER-PLAN.md v1.2 §4 Phase 0
2026-10-06 21:40:26 +03:00

148 lines
3.6 KiB
JSON

[
{
"id": "eqYDYibHxBt8NPq4",
"name": "Gitea Task Dispatcher",
"active": true,
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "gitea-task",
"options": {}
},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
0,
0
],
"webhookId": "fe5c7ad8-99fa-45f5-8e75-a365d7f08ae22"
},
{
"parameters": {
"jsCode": "const w = $input.first().json;\nconst d = w.body || {};\nconst action = d.action || '';\nif (action !== 'opened' && action !== 'closed') return [];\nconst i = d.issue || {};\nconst r = d.repository || {};\nconst prefix = action === 'closed' ? 'CLOSED' : 'NEW';\nconst text = prefix + ' ' + (i.title || '?') + ' #' + (i.number || '?') + ' in ' + (r.full_name || '?') + '\\n' + (i.html_url || '');\nreturn [{ json: { text: text, critical: action === 'closed', repo: r.full_name || '?', alert_type: 'gitea_issue_' + action, alert_text: text } }];"
},
"name": "Parse",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
240,
0
]
},
{
"parameters": {
"jsCode": "return $input.all().filter(it => it.json.critical);"
},
"name": "OnlyCritical",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
480,
-120
]
},
{
"parameters": {
"chatId": "273442500",
"text": "={{ $json.text }}"
},
"name": "Telegram Send",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
720,
-120
],
"credentials": {
"telegramApi": {
"id": "MI5ZSM5d514km2wE",
"name": "Telegram Bot"
}
}
},
{
"parameters": {
"operation": "insert",
"schema": {
"__rl": true,
"mode": "name",
"value": "public"
},
"table": {
"__rl": true,
"mode": "name",
"value": "alert_queue"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"host": "={{ $json.repo }}",
"alert_type": "={{ $json.alert_type }}",
"alert_text": "={{ $json.alert_text }}"
}
},
"options": {}
},
"name": "Queue Insert",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.5,
"position": [
480,
120
],
"credentials": {
"postgres": {
"id": "8czcy3lV8sUxWTd9",
"name": "Monitoring"
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Parse",
"type": "main",
"index": 0
}
]
]
},
"Parse": {
"main": [
[
{
"node": "OnlyCritical",
"type": "main",
"index": 0
},
{
"node": "Queue Insert",
"type": "main",
"index": 0
}
]
]
},
"OnlyCritical": {
"main": [
[
{
"node": "Telegram Send",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}
]