From 425986190bbdf89657b583b8d1c42e9f769e7f41 Mon Sep 17 00:00:00 2001 From: gitea Date: Mon, 1 Jan 2001 00:00:00 +0000 Subject: [PATCH] Update Gitea n8n backup.json --- Gitea n8n backup.json | 592 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 588 insertions(+), 4 deletions(-) diff --git a/Gitea n8n backup.json b/Gitea n8n backup.json index 0be5a2e..8d3d241 100644 --- a/Gitea n8n backup.json +++ b/Gitea n8n backup.json @@ -3,7 +3,7 @@ "createdAt": "2026-02-07T17:36:53.545Z", "id": "L6OfcqzxnGM8NxfHm5oJk", "name": "Gitea n8n backup", - "active": false, + "active": true, "isArchived": false, "nodes": [ { @@ -590,8 +590,8 @@ }, "pinData": {}, "versionId": "b781d821-7e2c-474a-884f-06f6bc47d286", - "activeVersionId": null, - "triggerCount": 0, + "activeVersionId": "b781d821-7e2c-474a-884f-06f6bc47d286", + "triggerCount": 1, "shared": [ { "updatedAt": "2026-02-07T17:36:53.546Z", @@ -601,6 +601,590 @@ "projectId": "cSAaWNJydnksD5EB" } ], - "activeVersion": null, + "activeVersion": { + "updatedAt": "2026-02-07T17:40:04.000Z", + "createdAt": "2026-02-07T17:36:53.548Z", + "versionId": "b781d821-7e2c-474a-884f-06f6bc47d286", + "workflowId": "L6OfcqzxnGM8NxfHm5oJk", + "nodes": [ + { + "parameters": { + "values": { + "string": [ + { + "name": "repo.url", + "value": "https://gitea.prinz-pilaw.de" + }, + { + "name": "repo.name", + "value": "n8n-workspace" + }, + { + "name": "repo.owner", + "value": "gitea" + } + ] + }, + "options": {} + }, + "id": "6d3e9933-85ce-4a22-836f-e7a59c4fb038", + "name": "Globals", + "type": "n8n-nodes-base.set", + "position": [ + 112, + 64 + ], + "typeVersion": 1 + }, + { + "parameters": { + "filters": {}, + "requestOptions": {} + }, + "id": "d6acbeff-552a-4779-a94c-c24088f728e5", + "name": "n8n", + "type": "n8n-nodes-base.n8n", + "position": [ + 352, + 64 + ], + "typeVersion": 1, + "credentials": { + "n8nApi": { + "id": "sRsWD6qTeQzLCxKg", + "name": "n8n-workspace-backup-token" + } + } + }, + { + "parameters": { + "rule": { + "interval": [ + {} + ] + } + }, + "id": "1dcaab50-e7c2-4bfc-8464-fd5cb0bb5ed8", + "name": "Schedule Trigger", + "type": "n8n-nodes-base.scheduleTrigger", + "position": [ + -112, + 64 + ], + "typeVersion": 1.2 + }, + { + "parameters": { + "content": "Workflow changes committed to the repository", + "height": 80 + }, + "id": "b809c16b-7132-40d3-81a4-e0a1409efb99", + "name": "Sticky Note", + "type": "n8n-nodes-base.stickyNote", + "position": [ + 2128, + 128 + ], + "typeVersion": 1 + }, + { + "parameters": { + "content": "Check if there are any changes in the workflow", + "height": 80 + }, + "id": "92c0bba6-a340-404f-a0c7-dd4d18c38bee", + "name": "Sticky Note1", + "type": "n8n-nodes-base.stickyNote", + "position": [ + 1760, + 0 + ], + "typeVersion": 1 + }, + { + "parameters": { + "content": "Create a new file for the workflow", + "height": 80 + }, + "id": "6966d7f4-9081-4fca-950c-ad1e8e5362b0", + "name": "Sticky Note2", + "type": "n8n-nodes-base.stickyNote", + "position": [ + 1312, + 400 + ], + "typeVersion": 1 + }, + { + "parameters": { + "content": "Check if file exists in the repository", + "height": 80 + }, + "id": "582690bc-7130-4f4b-b939-439aa4545b70", + "name": "Sticky Note3", + "type": "n8n-nodes-base.stickyNote", + "position": [ + 800, + 32 + ], + "typeVersion": 1 + }, + { + "parameters": { + "content": "Get all workflows", + "height": 80 + }, + "id": "2409f352-9eb1-4582-bd4f-bac52970c6f0", + "name": "Sticky Note5", + "type": "n8n-nodes-base.stickyNote", + "position": [ + 288, + 0 + ], + "typeVersion": 1 + }, + { + "parameters": { + "content": "Set variables", + "height": 80 + }, + "id": "4f08fe76-c648-48ec-aa9e-7f777118c553", + "name": "Sticky Note6", + "type": "n8n-nodes-base.stickyNote", + "position": [ + 0, + 0 + ], + "typeVersion": 1 + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "0a6b769a-c66d-4784-92c7-a70caa28e1ba", + "name": "item", + "type": "object", + "value": "={{ $node[\"ForEach\"].json }}" + } + ] + }, + "options": {} + }, + "id": "3f35b734-cc0e-455b-9b67-bfbe43bae391", + "name": "SetDataUpdateNode", + "type": "n8n-nodes-base.set", + "position": [ + 1424, + 64 + ], + "typeVersion": 3.4 + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "0a6b769a-c66d-4784-92c7-a70caa28e1ba", + "name": "item", + "type": "object", + "value": "={{ $node[\"ForEach\"].json }}" + } + ] + }, + "options": {} + }, + "id": "230daded-655c-47f3-8e38-4be2497880d7", + "name": "SetDataCreateNode", + "type": "n8n-nodes-base.set", + "position": [ + 720, + 464 + ], + "typeVersion": 3.4 + }, + { + "parameters": { + "jsCode": "const results = [];\n\n// Wir iterieren über alle Items (besser als input_dict[0] im Python-Code)\nfor (const item of $input.all()) {\n \n // Zugriff auf die Daten: entspricht input_dict[0].get('json').get('item')\n const innerData = item.json.item;\n\n if (innerData) {\n // Schritt 1: JSON schön formatieren (Pretty Print)\n const jsonString = JSON.stringify(innerData, null, 4);\n\n // Schritt 2 & 3: String in Base64 umwandeln\n // Buffer ist in Node.js/n8n Standard\n const base64String = Buffer.from(jsonString, 'utf8').toString('base64');\n\n // Schritt 5: Rückgabeobjekt erstellen\n results.push({\n json: {\n item: base64String\n }\n });\n }\n}\n\nreturn results;" + }, + "id": "a4e8412f-e5c7-472e-8add-d1b15ca9bc5c", + "name": "Base64EncodeUpdate", + "type": "n8n-nodes-base.code", + "position": [ + 1648, + 64 + ], + "typeVersion": 2 + }, + { + "parameters": { + "jsCode": "// Wir erstellen ein Array für die Ergebnisse\nconst results = [];\n\n// Wir iterieren über alle eingehenden Items (n8n Best Practice)\n// Der Python Code hat nur das erste Item [0] genommen, was oft ein Fehler ist.\nfor (const item of $input.all()) {\n\n // \"item.json.item\" entspricht dem Pfad aus deinem Python-Code:\n // inner_data = input_dict[0].get('json').get('item')\n const innerData = item.json.item;\n\n if (innerData) {\n // Schritt 1: JSON \"pretty print\" (Formatieren)\n const jsonString = JSON.stringify(innerData, null, 4);\n\n // Schritt 2 & 3: String zu Base64 encodieren\n // Buffer ist nativ in Node.js verfügbar\n const base64String = Buffer.from(jsonString, 'utf8').toString('base64');\n\n // Schritt 4: Ergebnis zum Array hinzufügen\n results.push({\n json: {\n item: base64String\n }\n });\n } else {\n // Fallback, falls \"item\" leer ist\n results.push({\n json: {\n item: null,\n error: \"Keine Daten im Feld 'item' gefunden\"\n }\n });\n }\n}\n\nreturn results;" + }, + "id": "04498688-c3f0-433e-b24e-46cf694bbc50", + "name": "Base64EncodeCreate", + "type": "n8n-nodes-base.code", + "position": [ + 1024, + 464 + ], + "typeVersion": 2 + }, + { + "parameters": { + "conditions": { + "options": { + "version": 2, + "leftValue": "", + "caseSensitive": true, + "typeValidation": "strict" + }, + "combinator": "or", + "conditions": [ + { + "id": "16a9182d-059d-4774-ba95-654fb4293fdb", + "operator": { + "type": "object", + "operation": "notExists", + "singleValue": true + }, + "leftValue": "={{ $json.error }}", + "rightValue": 404 + } + ] + }, + "options": { + "ignoreCase": false + } + }, + "id": "3579f0de-413d-4bad-8217-55854cb6e01e", + "name": "Exist", + "type": "n8n-nodes-base.if", + "position": [ + 1152, + 80 + ], + "executeOnce": false, + "typeVersion": 2.2, + "alwaysOutputData": false + }, + { + "parameters": { + "conditions": { + "options": { + "version": 2, + "leftValue": "", + "caseSensitive": true, + "typeValidation": "strict" + }, + "combinator": "and", + "conditions": [ + { + "id": "e0c66624-429a-4f1f-bf7b-1cc1b32bad7b", + "operator": { + "type": "string", + "operation": "notEquals" + }, + "leftValue": "={{ $json.item }}", + "rightValue": "={{ $('GetGitea').item.json.content }}" + } + ] + }, + "options": {} + }, + "id": "115d3433-b8f1-4d81-b149-8bb822e997b1", + "name": "Changed", + "type": "n8n-nodes-base.if", + "position": [ + 1872, + 64 + ], + "typeVersion": 2.2 + }, + { + "parameters": { + "method": "PUT", + "url": "={{ $('Globals').item.json.repo.url }}/api/v1/repos/{{ $('Globals').item.json.repo.owner }}/{{ $('Globals').item.json.repo.name }}/contents/{{ encodeURIComponent($('GetGitea').item.json.name) }}", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "sendBody": true, + "bodyParameters": { + "parameters": [ + { + "name": "content", + "value": "={{ $('Base64EncodeUpdate').item.json.item }}" + }, + { + "name": "sha", + "value": "={{ $('GetGitea').item.json.sha }}" + } + ] + }, + "options": {} + }, + "id": "bf83c6dd-f3ee-49c9-b939-8e017352cc0e", + "name": "PutGitea", + "type": "n8n-nodes-base.httpRequest", + "position": [ + 2208, + 192 + ], + "typeVersion": 4.2, + "credentials": { + "httpHeaderAuth": { + "id": "9rVued8FuUi6ySvN", + "name": "gittea" + } + } + }, + { + "parameters": { + "url": "={{ $('Globals').item.json.repo.url }}/api/v1/repos/{{ encodeURIComponent($('Globals').item.json.repo.owner) }}/{{ encodeURIComponent($('Globals').item.json.repo.name) }}/contents/{{ encodeURIComponent($json.name) }}.json", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": {} + }, + "id": "acc889b6-052e-413d-8506-dbf173bc73eb", + "name": "GetGitea", + "type": "n8n-nodes-base.httpRequest", + "position": [ + 880, + 80 + ], + "typeVersion": 4.2, + "credentials": { + "httpHeaderAuth": { + "id": "9rVued8FuUi6ySvN", + "name": "gittea" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "method": "POST", + "url": "={{ $('Globals').item.json.repo.url }}/api/v1/repos/{{ $('Globals').item.json.repo.owner }}/{{ $('Globals').item.json.repo.name }}/contents/{{ encodeURIComponent($('ForEach').item.json.name) }}.json", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "sendBody": true, + "bodyParameters": { + "parameters": [ + { + "name": "content", + "value": "={{ $json.item }}" + } + ] + }, + "options": {} + }, + "id": "ca4ddd25-e866-4d98-8d29-4e7786c3e323", + "name": "PostGitea", + "type": "n8n-nodes-base.httpRequest", + "position": [ + 1424, + 464 + ], + "typeVersion": 4.2, + "credentials": { + "httpHeaderAuth": { + "id": "9rVued8FuUi6ySvN", + "name": "gittea" + } + } + }, + { + "parameters": { + "options": {} + }, + "id": "686ab844-a3f5-4048-927f-6aa5fce089b8", + "name": "ForEach", + "type": "n8n-nodes-base.splitInBatches", + "position": [ + 560, + 64 + ], + "executeOnce": false, + "typeVersion": 3 + }, + { + "parameters": { + "content": "### **📌 Setup Guide for Backup Workflows to Git Repository on Gitea**\n\n#### **🔧 1. Configure Global Variables**\nGo to the **Globals** node and update the following:\n- **`repo.url`** → `https://your-gitea-instance.com` *(Replace with your actual Gitea URL)*\n- **`repo.name`** → `workflows` *(Repository name where backups will be stored)*\n- **`repo.owner`** → `octoleo` *(Gitea account that owns the repository)*\n\n📌 **These settings define where workflows will be backed up.**\n\n---\n\n#### **🔑 2. Set Up Gitea Authentication**\n1️⃣ **In Gitea:**\n- Generate a **Personal Access Token** under **Settings → Applications → Generate Token**\n- Ensure the token has **repo read/write permissions**\n\n2️⃣ **In the Credentials Manager:**\n- Create a new **Gitea Token** credential\n- Set the **Name** as `Authorization`\n- Set the **Value** as:\n```\nBearer YOUR_TOKEN_HERE\n```\n📌 **Ensure there is a space after `Bearer` before the token!**\n\n---\n\n#### **🔗 3. Connect Gitea Credentials to Git Nodes**\n- Open each of these **three Git nodes**:\n- **GetGitea** → Retrieves existing repository data\n- **PutGitea** → Updates workflows\n- **PostGitea** → Adds new workflows\n\n- Assign the **Gitea Token** credential to each node.\n\n📌 **These nodes handle pushing your workflows to Gitea.**\n\n---\n\n#### **🌐 4. Set Up API Credentials for Workflow Retrieval**\n- Locate the API request node that **fetches workflows**.\n- Add your **API authentication credentials** (Token or Basic Auth).\n\n📌 **This ensures the workflow can fetch all available workflows from your system.**\n\n---\n\n#### **🛠️ 5. Test & Activate the Workflow**\n✅ **Run the workflow manually** → Check that workflows are being backed up correctly.\n✅ **Review the Gitea repository** → Ensure the files are updated.\n✅ **Enable the scheduled trigger** → Automates backups at defined intervals.\n\n📌 **The workflow automatically checks for changes before committing updates!**\n\n---\n\n### **🚀 Done! Your Workflows Are Now Backed Up Securely!**\n💬 Have issues? **Reach out on the forum for help!**", + "height": 1620, + "width": 560 + }, + "id": "5084834c-0509-4ca1-a781-8d02c4d6184b", + "name": "Sticky Note4", + "type": "n8n-nodes-base.stickyNote", + "position": [ + -112, + 272 + ], + "typeVersion": 1 + } + ], + "connections": { + "n8n": { + "main": [ + [ + { + "node": "ForEach", + "type": "main", + "index": 0 + } + ] + ] + }, + "Exist": { + "main": [ + [ + { + "node": "SetDataUpdateNode", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "SetDataCreateNode", + "type": "main", + "index": 0 + } + ] + ] + }, + "Changed": { + "main": [ + [ + { + "node": "PutGitea", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "ForEach", + "type": "main", + "index": 0 + } + ] + ] + }, + "ForEach": { + "main": [ + [], + [ + { + "node": "GetGitea", + "type": "main", + "index": 0 + } + ] + ] + }, + "Globals": { + "main": [ + [ + { + "node": "n8n", + "type": "main", + "index": 0 + } + ] + ] + }, + "GetGitea": { + "main": [ + [ + { + "node": "Exist", + "type": "main", + "index": 0 + } + ] + ] + }, + "PutGitea": { + "main": [ + [ + { + "node": "ForEach", + "type": "main", + "index": 0 + } + ] + ] + }, + "PostGitea": { + "main": [ + [ + { + "node": "ForEach", + "type": "main", + "index": 0 + } + ] + ] + }, + "Schedule Trigger": { + "main": [ + [ + { + "node": "Globals", + "type": "main", + "index": 0 + } + ] + ] + }, + "SetDataCreateNode": { + "main": [ + [ + { + "node": "Base64EncodeCreate", + "type": "main", + "index": 0 + } + ] + ] + }, + "SetDataUpdateNode": { + "main": [ + [ + { + "node": "Base64EncodeUpdate", + "type": "main", + "index": 0 + } + ] + ] + }, + "Base64EncodeCreate": { + "main": [ + [ + { + "node": "PostGitea", + "type": "main", + "index": 0 + } + ] + ] + }, + "Base64EncodeUpdate": { + "main": [ + [ + { + "node": "Changed", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "authors": "Prasanna Ranjan", + "name": "Version b781d821", + "description": "", + "autosaved": false + }, "tags": [] } \ No newline at end of file