{ "name": "A - Deploy notifier", "nodes": [ { "id": "a1", "name": "Forgejo push", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ 0, 0 ], "webhookId": "REPLACE_ON_IMPORT", "parameters": { "httpMethod": "POST", "path": "forgejo-push", "responseMode": "onReceived", "options": {} } }, { "id": "a2", "name": "Format message", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 240, 0 ], "parameters": { "jsCode": "\n// The Forgejo push payload, reduced to the five things a human wants to know.\nconst b = $json.body ?? $json;\nconst repo = b.repository?.full_name ?? 'unknown/unknown';\nconst branch = String(b.ref ?? '').replace('refs/heads/', '');\nconst commits = Array.isArray(b.commits) ? b.commits : [];\nconst head = commits[commits.length - 1] ?? {};\nconst author = head.author?.name ?? b.pusher?.username ?? b.sender?.username ?? 'unknown';\nconst subject = String(head.message ?? '').split('\\n')[0].slice(0, 120);\nconst short = String(head.id ?? '').slice(0, 8);\nconst link = head.url ?? b.compare_url ?? b.repository?.html_url ?? '';\n\nreturn [{\n json: {\n pushTitle: repo + ' / ' + branch,\n text: commits.length + ' commit(s) by ' + author + '\\n' + short + ' ' + subject,\n link,\n repo, branch, author, subject, short,\n commitCount: commits.length,\n },\n}];\n" } }, { "id": "a3", "name": "Push to ntfy", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 480, 0 ], "parameters": { "method": "POST", "url": "http://ntfy/deploys", "authentication": "genericCredentialType", "genericAuthType": "httpBasicAuth", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "X-Title", "value": "={{ $json.pushTitle }}" }, { "name": "X-Priority", "value": "3" }, { "name": "X-Click", "value": "={{ $json.link }}" } ] }, "sendBody": true, "contentType": "raw", "rawContentType": "text/plain", "body": "={{ $json.text }}", "options": {} }, "credentials": { "httpBasicAuth": { "id": "REPLACE_WITH_YOUR_CREDENTIAL_ID", "name": "ntfy (n8n user)" } } } ], "connections": { "Forgejo push": { "main": [ [ { "node": "Format message", "type": "main", "index": 0 } ] ] }, "Format message": { "main": [ [ { "node": "Push to ntfy", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "active": false }