Update Backup workflows to git repository on Gitea.json

This commit is contained in:
2001-01-01 00:00:00 +00:00
parent 2a3857a0fa
commit ba571d37a3

View File

@@ -1,7 +1,7 @@
{
"updatedAt": "2025-11-23T08:46:36.000Z",
"createdAt": "2025-11-23T08:34:12.767Z",
"id": "fsaojBpJsioS4FYe",
"updatedAt": "2026-02-07T17:36:07.554Z",
"createdAt": "2026-02-07T17:26:56.088Z",
"id": "ELSlHxqYRAgcoG7FM610k",
"name": "Backup workflows to git repository on Gitea",
"active": false,
"isArchived": false,
@@ -26,12 +26,12 @@
},
"options": {}
},
"id": "b6997dbf-2f79-4c4f-a6cf-6dbb76c547cd",
"id": "34f39470-ae54-4816-b50c-cb86ad547cf7",
"name": "Globals",
"type": "n8n-nodes-base.set",
"position": [
464,
96
112,
64
],
"typeVersion": 1
},
@@ -40,14 +40,20 @@
"filters": {},
"requestOptions": {}
},
"id": "d6b7dbc9-8f6c-4922-a725-6f5e2cbf5e50",
"id": "129e03c7-299b-49cf-8fb6-2f953b951e9f",
"name": "n8n",
"type": "n8n-nodes-base.n8n",
"position": [
704,
96
352,
64
],
"typeVersion": 1
"typeVersion": 1,
"credentials": {
"n8nApi": {
"id": "sRsWD6qTeQzLCxKg",
"name": "n8n-workspace-backup-token"
}
}
},
{
"parameters": {
@@ -60,12 +66,12 @@
]
}
},
"id": "312ab6a1-64e1-4b63-b94b-87619a7eb184",
"id": "3551acee-8513-4cf5-a878-443a2a0980c6",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
240,
96
-112,
64
],
"typeVersion": 1.2
},
@@ -74,12 +80,12 @@
"content": "Workflow changes committed to the repository",
"height": 80
},
"id": "5a6a4dd1-d86b-43f2-80df-4b430615f4e9",
"id": "43454e8f-d2ed-47d5-ad83-14a5eefdd87d",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
2480,
160
2128,
128
],
"typeVersion": 1
},
@@ -88,12 +94,12 @@
"content": "Check if there are any changes in the workflow",
"height": 80
},
"id": "f342c5df-d6a3-4997-a94e-f6affd4e929f",
"id": "031d6185-04c5-4668-bc19-157d36042ea6",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
2112,
32
1760,
0
],
"typeVersion": 1
},
@@ -102,12 +108,12 @@
"content": "Create a new file for the workflow",
"height": 80
},
"id": "0f93a72a-faf6-4177-bffa-7d4088c0bce7",
"id": "347eaab7-b7be-4156-a1a5-4b2b5f5c8336",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1664,
432
1312,
400
],
"typeVersion": 1
},
@@ -116,12 +122,12 @@
"content": "Check if file exists in the repository",
"height": 80
},
"id": "4f89f7e1-90c6-4b2a-b928-5839ba0e03e3",
"id": "2290978f-79c6-4782-ab5b-0b7085935b34",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1152,
64
800,
32
],
"typeVersion": 1
},
@@ -130,12 +136,12 @@
"content": "Get all workflows",
"height": 80
},
"id": "2939ebe5-a9ce-4103-b44e-336ae2ac5903",
"id": "3b77938a-2156-46cd-b055-d5a03697d326",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
32
288,
0
],
"typeVersion": 1
},
@@ -144,12 +150,12 @@
"content": "Set variables",
"height": 80
},
"id": "1fa6cc74-f22d-4106-84dc-36478abb400d",
"id": "fabcf735-0f3f-4d47-8986-37004737667c",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
32
0,
0
],
"typeVersion": 1
},
@@ -167,12 +173,12 @@
},
"options": {}
},
"id": "b22a1647-7c9f-4dc2-9f9c-44461dece4fc",
"id": "590e1db3-d167-418c-a97d-cdbccefa9701",
"name": "SetDataUpdateNode",
"type": "n8n-nodes-base.set",
"position": [
1776,
96
1424,
64
],
"typeVersion": 3.4
},
@@ -190,40 +196,39 @@
},
"options": {}
},
"id": "65a08a09-ee06-4e99-addb-4e94bf32caf2",
"id": "dafa7f4f-9088-4061-a3db-63ac49711b3d",
"name": "SetDataCreateNode",
"type": "n8n-nodes-base.set",
"position": [
1072,
496
720,
464
],
"typeVersion": 3.4
},
{
"parameters": {
"language": "python",
"pythonCode": "import json\nimport base64\nfrom js import Object\n\n# Assuming _input.all() returns a JavaScript object\njs_object = _input.all()\n\n# Convert the JsProxy object to a Python dictionary\ndef js_to_py(js_obj):\n if isinstance(js_obj, (str, int, float, bool)) or js_obj is None:\n # Base types are already Python-compatible\n return js_obj\n elif isinstance(js_obj, list):\n # Convert lists recursively\n return [js_to_py(item) for item in js_obj]\n elif hasattr(js_obj, \"__iter__\") and not isinstance(js_obj, str):\n # Handle JsProxy objects (JavaScript objects or arrays)\n if hasattr(js_obj, \"keys\"):\n # If it has keys, treat it as a dictionary\n return {key: js_to_py(js_obj[key]) for key in Object.keys(js_obj)}\n else:\n # Otherwise, treat it as a list\n return [js_to_py(item) for item in js_obj]\n else:\n # Fallback for other types\n return js_obj\n\n# Convert the JavaScript object to a Python dictionary\ninput_dict = js_to_py(js_object)\n\n# Step 0: get the correct data set of the workflow\ninner_data = input_dict[0].get('json').get('item')\n\n# Step 1: Convert the dictionary to a pretty-printed JSON string\njson_string = json.dumps(inner_data, indent=4)\n\n# Step 2: Encode the JSON string to bytes\njson_bytes = json_string.encode('utf-8')\n\n# Step 3: Convert the bytes to a base64 string\nbase64_string = base64.b64encode(json_bytes).decode('utf-8')\n\n# Step 5: Create the return object with the base64 string and its SHA-256 hash\nreturn_object = {\n \"item\": base64_string\n}\n\n# Return the object\nreturn return_object"
"language": "pythonNative",
"pythonCode": "# Loop over input items and add a new field called 'my_new_field' to the JSON of each one\nfor item in _items:\n item[\"json\"][\"my_new_field\"] = 1\nreturn _items"
},
"id": "2d99bcb9-7de7-4db0-a2e3-976754d9034d",
"id": "9ed8fa7d-8e21-46bd-b8dc-19f7ba28bdb2",
"name": "Base64EncodeUpdate",
"type": "n8n-nodes-base.code",
"position": [
2000,
96
1648,
64
],
"typeVersion": 2
},
{
"parameters": {
"language": "python",
"pythonCode": "import json\nimport base64\nfrom js import Object\n\n# Assuming _input.all() returns a JavaScript object\njs_object = _input.all()\n\n# Convert the JsProxy object to a Python dictionary\ndef js_to_py(js_obj):\n if isinstance(js_obj, (str, int, float, bool)) or js_obj is None:\n # Base types are already Python-compatible\n return js_obj\n elif isinstance(js_obj, list):\n # Convert lists recursively\n return [js_to_py(item) for item in js_obj]\n elif hasattr(js_obj, \"__iter__\") and not isinstance(js_obj, str):\n # Handle JsProxy objects (JavaScript objects or arrays)\n if hasattr(js_obj, \"keys\"):\n # If it has keys, treat it as a dictionary\n return {key: js_to_py(js_obj[key]) for key in Object.keys(js_obj)}\n else:\n # Otherwise, treat it as a list\n return [js_to_py(item) for item in js_obj]\n else:\n # Fallback for other types\n return js_obj\n\n# Convert the JavaScript object to a Python dictionary\ninput_dict = js_to_py(js_object)\n\n# Step 0: get the correct data set of the workflow\ninner_data = input_dict[0].get('json').get('item')\n\n# Step 1: Convert the dictionary to a pretty-printed JSON string\njson_string = json.dumps(inner_data, indent=4)\n\n# Step 2: Encode the JSON string to bytes\njson_bytes = json_string.encode('utf-8')\n\n# Step 3: Convert the bytes to a base64 string\nbase64_string = base64.b64encode(json_bytes).decode('utf-8')\n\n# Step 4: Create the return object with the base64 string in 'item'\nreturn_object = {\n \"item\": base64_string\n}\n\n# Return the object\nreturn return_object"
"language": "python"
},
"id": "6ff133d8-17bf-4872-92d4-6d9e734a04d5",
"id": "d77edd2c-5ef8-494c-9d05-b269f0d75a53",
"name": "Base64EncodeCreate",
"type": "n8n-nodes-base.code",
"position": [
1376,
496
1024,
464
],
"typeVersion": 2
},
@@ -254,12 +259,12 @@
"ignoreCase": false
}
},
"id": "c05cef97-1733-4676-9944-24c9bd8ddeca",
"id": "19f7391d-5035-4ea0-a38c-9d7068cff3f8",
"name": "Exist",
"type": "n8n-nodes-base.if",
"position": [
1504,
112
1152,
80
],
"executeOnce": false,
"typeVersion": 2.2,
@@ -289,12 +294,12 @@
},
"options": {}
},
"id": "000af828-3eaf-4b9d-b212-4c69aa1976bc",
"id": "21374491-bf17-4fd8-b9b9-6eeb38ae56e2",
"name": "Changed",
"type": "n8n-nodes-base.if",
"position": [
2224,
96
1872,
64
],
"typeVersion": 2.2
},
@@ -319,20 +324,14 @@
},
"options": {}
},
"id": "f79dd651-3891-4e9b-b2e8-be5bfa1fe7eb",
"id": "8460c95b-9304-4356-9d92-e953312cbbf4",
"name": "PutGitea",
"type": "n8n-nodes-base.httpRequest",
"position": [
2560,
224
2208,
192
],
"typeVersion": 4.2,
"credentials": {
"httpHeaderAuth": {
"id": "NEnkbkj4tAvlTLD8",
"name": "Header Auth account"
}
}
"typeVersion": 4.2
},
{
"parameters": {
@@ -341,18 +340,18 @@
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"id": "4424b8ad-143a-4d3d-b99d-dcee4f02a710",
"id": "1021ef3f-4bb6-4821-80ca-fbf342a4bd2f",
"name": "GetGitea",
"type": "n8n-nodes-base.httpRequest",
"position": [
1232,
112
880,
80
],
"typeVersion": 4.2,
"credentials": {
"httpHeaderAuth": {
"id": "NEnkbkj4tAvlTLD8",
"name": "Header Auth account"
"id": "9rVued8FuUi6ySvN",
"name": "gittea"
}
},
"onError": "continueRegularOutput"
@@ -374,18 +373,18 @@
},
"options": {}
},
"id": "fc17d602-92e1-411b-8ba4-00f62046fd2b",
"id": "36ff91a0-c476-4b14-96b9-074fd80312a5",
"name": "PostGitea",
"type": "n8n-nodes-base.httpRequest",
"position": [
1776,
496
1424,
464
],
"typeVersion": 4.2,
"credentials": {
"httpHeaderAuth": {
"id": "NEnkbkj4tAvlTLD8",
"name": "Header Auth account"
"id": "9rVued8FuUi6ySvN",
"name": "gittea"
}
}
},
@@ -393,12 +392,12 @@
"parameters": {
"options": {}
},
"id": "ef790cca-0082-408f-bed3-5abf0496082c",
"id": "1ed03af6-df51-410b-a479-5c1fd6327e58",
"name": "ForEach",
"type": "n8n-nodes-base.splitInBatches",
"position": [
912,
96
560,
64
],
"executeOnce": false,
"typeVersion": 3
@@ -409,12 +408,12 @@
"height": 1620,
"width": 560
},
"id": "5b242ecc-275e-4d70-861b-64d4b3fcdc82",
"id": "5411d3bf-23f2-4fa3-a1c7-e1d4e370006e",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
304
-112,
272
],
"typeVersion": 1
}
@@ -580,21 +579,26 @@
}
},
"settings": {
"executionOrder": "v1"
"executionOrder": "v1",
"availableInMCP": false
},
"staticData": null,
"meta": null,
"meta": {
"templateCredsSetupCompleted": true
},
"pinData": {},
"versionId": "49f3b1f9-d281-48df-82e3-26402fb9bd2a",
"versionId": "d2fe11dc-e8fd-4eb7-8b84-5831e9eedd80",
"activeVersionId": null,
"triggerCount": 0,
"shared": [
{
"updatedAt": "2025-11-23T08:34:14.534Z",
"createdAt": "2025-11-23T08:34:14.534Z",
"updatedAt": "2026-02-07T17:26:56.090Z",
"createdAt": "2026-02-07T17:26:56.090Z",
"role": "workflow:owner",
"workflowId": "fsaojBpJsioS4FYe",
"projectId": "S4tmpzSj6JlGFOze"
"workflowId": "ELSlHxqYRAgcoG7FM610k",
"projectId": "cSAaWNJydnksD5EB"
}
],
"activeVersion": null,
"tags": []
}