This workflow corresponds to n8n.io template #3990 — we link there as the canonical source.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "696255b0-7786-410c-927f-ffb4fa7784b9",
"name": "On clicking 'execute'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
400,
-400
],
"parameters": {},
"typeVersion": 1
},
{
"id": "5ffbd7ff-596c-4d69-a327-95ab9e31c144",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
140
],
"parameters": {
"color": 6,
"width": 2111,
"height": 752,
"content": "## Subworkflow"
},
"typeVersion": 1
},
{
"id": "d552bfbd-24cc-43ab-b008-ba837525e234",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
180,
540
],
"parameters": {},
"typeVersion": 1
},
{
"id": "4cf656ea-b62c-4c9a-9a2c-f3cd4736af6f",
"name": "n8n",
"type": "n8n-nodes-base.n8n",
"position": [
800,
-300
],
"parameters": {
"filters": {},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "bc776b1e-de7a-4c5c-ab3e-fc6ede7f6d93",
"name": "Return",
"type": "n8n-nodes-base.set",
"position": [
2140,
340
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8d513345-6484-431f-afb7-7cf045c90f4f",
"name": "Done",
"type": "boolean",
"value": true
}
]
}
},
"typeVersion": 3.3
},
{
"id": "cc1748c6-972e-4909-a0d9-2aada40e49b6",
"name": "If file too large",
"type": "n8n-nodes-base.if",
"position": [
820,
260
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "45ce825e-9fa6-430c-8931-9aaf22c42585",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.content }}",
"rightValue": ""
},
{
"id": "3ce332ca-3827-4c2d-becd-837da737d285",
"operator": {
"type": "string",
"operation": "notExists",
"singleValue": true
},
"leftValue": "={{ $json.error }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2
},
{
"id": "68c529b3-8530-42c9-8efa-7c35ea6c24f0",
"name": "Merge Items",
"type": "n8n-nodes-base.merge",
"position": [
820,
520
],
"parameters": {},
"typeVersion": 2
},
{
"id": "627cc21c-1f7f-4266-a558-357289bb2746",
"name": "Same file - Do nothing",
"type": "n8n-nodes-base.noOp",
"position": [
1680,
340
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6e77f25e-b58c-4e23-a5c7-1951c36e59b6",
"name": "File is different",
"type": "n8n-nodes-base.noOp",
"position": [
1680,
500
],
"parameters": {},
"typeVersion": 1
},
{
"id": "37d72317-7140-45eb-ac62-e88ec7b9fc97",
"name": "File is new",
"type": "n8n-nodes-base.noOp",
"position": [
1680,
700
],
"parameters": {},
"typeVersion": 1
},
{
"id": "770c9612-e6fb-4d6c-9a89-459e7d5acc31",
"name": "Create new file",
"type": "n8n-nodes-base.github",
"position": [
1900,
700
],
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $('Config').first().json.repo_owner }}"
},
"filePath": "={{ $('Create sub path').item.json.subPath }}/{{ $('Execute Workflow Trigger').first().json.id }}.json",
"resource": "file",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $('Config').first().json.repo_name }}"
},
"fileContent": "={{ JSON.stringify($('Config').first().json.data) }}",
"commitMessage": "={{$('Execute Workflow Trigger').first().json.name}} ({{$json.githubStatus}})"
},
"credentials": {
"githubApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "121272d6-0535-494e-b14a-3cc00f87cb8d",
"name": "Edit existing file",
"type": "n8n-nodes-base.github",
"position": [
1900,
500
],
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $('Config').first().json.repo_owner }}"
},
"filePath": "={{ $('Create sub path').item.json.subPath }}/{{ $('Execute Workflow Trigger').first().json.id }}.json",
"resource": "file",
"operation": "edit",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $('Config').first().json.repo_name }}"
},
"fileContent": "={{ JSON.stringify($('Config').first().json.data) }}",
"commitMessage": "={{$('Execute Workflow Trigger').first().json.name}} ({{ $json.githubStatus }})"
},
"credentials": {
"githubApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "2847116a-c862-4803-8079-a40e4edd22f7",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1000,
-300
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "ec0c92a3-73fa-480b-bdd3-e51648e8b0a0",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
400,
-200
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [
6
],
"triggerAtHour": 1
}
]
}
},
"typeVersion": 1.2
},
{
"id": "289ec775-7191-4710-85e8-ae33542f9fbd",
"name": "Create sub path",
"type": "n8n-nodes-base.set",
"position": [
1260,
520
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "dae43d3b-56e5-4098-b602-862ebf5cd073",
"name": "subPath",
"type": "string",
"value": "={{ $now.setZone('UTC').toFormat('yyyy') }}/{{ $now.setZone('UTC').toFormat('MM') }}/{{ $now.setZone('UTC').toFormat('dd') }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.3
},
{
"id": "b9bf504a-3acf-4706-992d-a522e9693df8",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
-500
],
"parameters": {
"color": 7,
"width": 2113,
"height": 616,
"content": "## Main workflow loop"
},
"typeVersion": 1
},
{
"id": "2470503e-cb6a-44a5-a4aa-b431874e2e09",
"name": "Config",
"type": "n8n-nodes-base.set",
"position": [
440,
540
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8f6d1741-772f-462a-811f-4c334185e4f0",
"name": "repo_owner",
"type": "string",
"value": "=datproto"
},
{
"id": "8cac215c-4fd7-422f-9fd2-6b2d1e5e0383",
"name": "repo_name",
"type": "string",
"value": "=datproto-backup-n8n"
},
{
"id": "2b38f96a-a970-4d13-900e-f15e4cd65c51",
"name": "data",
"type": "object",
"value": "={{\n {\n \"nodes\": $('Execute Workflow Trigger').item.json.nodes,\n \"connections\": $('Execute Workflow Trigger').item.json.connections,\n \"pinData\": $('Execute Workflow Trigger').item.json.pinData,\n \"meta\": $('Execute Workflow Trigger').item.json.meta\n }\n}}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "a7d835f2-de5e-4121-acad-9041c126401c",
"name": "Starting Message",
"type": "n8n-nodes-base.discord",
"position": [
600,
-300
],
"parameters": {
"content": "=The Git backup here. Below is my latest activity:\n```\n\ud83d\udc49 Starting Workflow Backup [{{ $execution.id }}]\n```",
"guildId": {
"__rl": true,
"mode": "list",
"value": "1344944764851851344",
"cachedResultUrl": "https://discord.com/channels/1344944764851851344",
"cachedResultName": "Dat Proto's server"
},
"options": {},
"resource": "message",
"channelId": {
"__rl": true,
"mode": "list",
"value": "1344944973958873212",
"cachedResultUrl": "https://discord.com/channels/1344944764851851344/1344944973958873212",
"cachedResultName": "n8n"
}
},
"credentials": {
"discordBotApi": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "c71ddc51-cbf9-4437-b2b4-9d60f2e1a039",
"name": "Completed Notification",
"type": "n8n-nodes-base.discord",
"position": [
1640,
-440
],
"parameters": {
"content": "=The Git backup here. Below is my latest activity:\n```\n\u2705 Backup has completed - {{ $('n8n').all().length }} workflows have been processed.\n```",
"guildId": {
"__rl": true,
"mode": "list",
"value": "1344944764851851344",
"cachedResultUrl": "https://discord.com/channels/1344944764851851344",
"cachedResultName": "Dat Proto's server"
},
"options": {},
"resource": "message",
"channelId": {
"__rl": true,
"mode": "list",
"value": "1344944973958873212",
"cachedResultUrl": "https://discord.com/channels/1344944764851851344/1344944973958873212",
"cachedResultName": "n8n"
}
},
"credentials": {
"discordBotApi": {
"name": "<your credential>"
}
},
"executeOnce": true,
"typeVersion": 2
},
{
"id": "110ba2cd-6a39-4663-81d5-6b2893d42e18",
"name": "Get file data",
"type": "n8n-nodes-base.github",
"position": [
620,
260
],
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo_owner }}"
},
"filePath": "={{ $now.setZone('UTC').toFormat('yyyy') }}/{{ $now.setZone('UTC').toFormat('MM') }}/{{ $now.setZone('UTC').toFormat('dd') }}/{{ $('Execute Workflow Trigger').item.json.id }}.json",
"resource": "file",
"operation": "get",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo_name }}"
},
"asBinaryProperty": false,
"additionalParameters": {}
},
"credentials": {
"githubApi": {
"name": "<your credential>"
}
},
"typeVersion": 1,
"continueOnFail": true,
"alwaysOutputData": true
},
{
"id": "2bdbcb80-2c2b-4fb8-bddb-eb9e6c6db0e0",
"name": "Execute Workflow",
"type": "n8n-nodes-base.executeWorkflow",
"onError": "continueErrorOutput",
"position": [
1420,
-200
],
"parameters": {
"options": {},
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $workflow.id }}"
},
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2
},
{
"id": "2366b904-8f2f-42ce-aa2f-fc941cb73ad4",
"name": "Wait",
"type": "n8n-nodes-base.wait",
"position": [
1640,
-100
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "e9ad632a-0506-4709-a485-67c45bf388f6",
"name": "Get file",
"type": "n8n-nodes-base.github",
"position": [
1040,
240
],
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $('Config').item.json.repo_owner }}"
},
"filePath": "={{ $now.setZone('UTC').toFormat('yyyy') }}/{{ $now.setZone('UTC').toFormat('MM') }}/{{ $now.setZone('UTC').toFormat('dd') }}/{{ $('Execute Workflow Trigger').item.json.id }}.json",
"resource": "file",
"operation": "get",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $('Config').item.json.repo_name }}"
},
"additionalParameters": {}
},
"credentials": {
"githubApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "656913c3-cb57-4129-ae12-42f70800a9ef",
"name": "Wait1",
"type": "n8n-nodes-base.wait",
"position": [
1420,
-440
],
"parameters": {
"amount": 10
},
"typeVersion": 1.1
},
{
"id": "09738ea8-1a61-4967-ac3d-2a9f64b39329",
"name": "verifyTheDifference",
"type": "n8n-nodes-base.code",
"position": [
1040,
520
],
"parameters": {
"jsCode": "const _ = require(\"underscore\")\n\nlet fileInput = null\n\nif (Object.keys($input.first().json).includes(\"content\")) {\n fileInput = JSON.parse(Buffer.from($input.all()[0].json.content, 'base64').toString())\n}\n\nconst n8nInput = $input.last().json.data\n\nif (!fileInput) {\n return {\n \"githubStatus\": \"new\"\n }\n}\n\nif (_.isMatch(fileInput, n8nInput)) {\n return {\n \"githubStatus\": \"same\"\n }\n} else {\n return {\n \"githubStatus\": \"different\"\n }\n}"
},
"typeVersion": 2
},
{
"id": "7cb7b34c-8742-44c3-9792-1084abf2783a",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
1460,
520
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "same",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1e6de6b4-3074-41bc-8a9d-465c0eb9a773",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('verifyTheDifference').first().json.githubStatus }}",
"rightValue": "same"
}
]
},
"renameOutput": true
},
{
"outputKey": "different",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cf6e130e-c85d-4a24-b11a-abfd0ecfcb19",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('verifyTheDifference').first().json.githubStatus }}",
"rightValue": "different"
}
]
},
"renameOutput": true
},
{
"outputKey": "=new",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f2fc6dda-85f5-4b81-b016-3e033b1dbcab",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('verifyTheDifference').first().json.githubStatus }}",
"rightValue": "new"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "c6410f39-34d8-448f-9efd-d66da067637b",
"name": "Wait2",
"type": "n8n-nodes-base.wait",
"position": [
1640,
-280
],
"parameters": {
"amount": 10
},
"typeVersion": 1.1
},
{
"id": "a3c4ff40-9887-4e38-985a-f32536d9306f",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-540,
-500
],
"parameters": {
"color": 4,
"width": 680,
"height": 1400,
"content": "# Workflows backup to Github\n======================================================================\n\n## Introduction\nThis workflow will backup all of your existed workflows to a single Github repository.\n\nThe Backup folders' name are based on the current backup date and have default format: \"yyyy/MM/dd\" (setup at \"Create sub path\" node).\n\nThroughout the backup process, the N8N will inform user via discord with clear message about Start, Success and Failure backups.\n\n## Tech Stack\nThe following nodes / services / libraries are used in this workflow:\n\n### Nodes:\n1. **Discord:** To send message to configured setup channel.\n2. **N8N:** To get all workflows' information.\n3. **Github:** To store backup data.\n4. **Code:** To run data comparison (Existed vs Latest workflow data).\n5. **Wait:** To avoid discord message rate limit.\n\n### External libraries:\n1. **Underscore.js:** JavaScript library that provides lots of common Javascript functions, to help user save time when using code node.\n\n## Guideline\n1. Open \"Config\" node and setup the following information:\n - **repo_owner:** Your Github username.\n - **repo_name:** The repository that you want to store workflows backup data.\n2. Open \"Create sub path\" node and change the naming and path format of backup folder(s).\n3. Setup custom messages in 3 discord nodes:\n - **Starting Message:** N8N inform user at the time workflow start.\n - **Inform Success Flows:** After each success backup, N8N will notify user.\n - **Inform Failed Flows:** After each failure backup, N8N will notify user to have appropriate action.\n - **Completed Notifications:** Then at the final, the workflow will give user a summary."
},
"typeVersion": 1
},
{
"id": "d511ce8a-1617-4a2a-96d8-6e71ddc372b7",
"name": "Inform Success Flows",
"type": "n8n-nodes-base.discord",
"onError": "continueRegularOutput",
"position": [
1840,
-280
],
"parameters": {
"content": "=The Git backup here. Below is my latest activity:\n```\n\u2705 Success to backup {{ $('Loop Over Items').item.json.id }}\n```",
"guildId": {
"__rl": true,
"mode": "list",
"value": "1344944764851851344",
"cachedResultUrl": "https://discord.com/channels/1344944764851851344",
"cachedResultName": "Dat Proto's server"
},
"options": {},
"resource": "message",
"channelId": {
"__rl": true,
"mode": "list",
"value": "1344944973958873212",
"cachedResultUrl": "https://discord.com/channels/1344944764851851344/1344944973958873212",
"cachedResultName": "n8n"
}
},
"credentials": {
"discordBotApi": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "21052f64-d4b6-4b67-8cb4-dd022a0dab71",
"name": "Inform Failed Flows",
"type": "n8n-nodes-base.discord",
"position": [
1840,
-100
],
"parameters": {
"content": "=The Git backup here. Below is my latest activity:\n```\n\ud83d\udc49 Failed to backup {{ $('Loop Over Items').item.json.id }}\n```",
"guildId": {
"__rl": true,
"mode": "list",
"value": "1344944764851851344",
"cachedResultUrl": "https://discord.com/channels/1344944764851851344",
"cachedResultName": "Dat Proto's server"
},
"options": {},
"resource": "message",
"channelId": {
"__rl": true,
"mode": "list",
"value": "1344944973958873212",
"cachedResultUrl": "https://discord.com/channels/1344944764851851344/1344944973958873212",
"cachedResultName": "n8n"
}
},
"credentials": {
"discordBotApi": {
"name": "<your credential>"
}
},
"typeVersion": 2
}
],
"connections": {
"n8n": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Inform Failed Flows",
"type": "main",
"index": 0
}
]
]
},
"Wait1": {
"main": [
[
{
"node": "Completed Notification",
"type": "main",
"index": 0
}
]
]
},
"Wait2": {
"main": [
[
{
"node": "Inform Success Flows",
"type": "main",
"index": 0
}
]
]
},
"Config": {
"main": [
[
{
"node": "Merge Items",
"type": "main",
"index": 1
},
{
"node": "Get file data",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Same file - Do nothing",
"type": "main",
"index": 0
}
],
[
{
"node": "File is different",
"type": "main",
"index": 0
}
],
[
{
"node": "File is new",
"type": "main",
"index": 0
}
]
]
},
"Get file": {
"main": [
[
{
"node": "Merge Items",
"type": "main",
"index": 0
}
]
]
},
"File is new": {
"main": [
[
{
"node": "Create new file",
"type": "main",
"index": 0
}
]
]
},
"Merge Items": {
"main": [
[
{
"node": "verifyTheDifference",
"type": "main",
"index": 0
}
]
]
},
"Get file data": {
"main": [
[
{
"node": "If file too large",
"type": "main",
"index": 0
}
]
]
},
"Create new file": {
"main": [
[
{
"node": "Return",
"type": "main",
"index": 0
}
]
]
},
"Create sub path": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Wait1",
"type": "main",
"index": 0
}
],
[
{
"node": "Execute Workflow",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow": {
"main": [
[
{
"node": "Wait2",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Starting Message",
"type": "main",
"index": 0
}
]
]
},
"Starting Message": {
"main": [
[
{
"node": "n8n",
"type": "main",
"index": 0
}
]
]
},
"File is different": {
"main": [
[
{
"node": "Edit existing file",
"type": "main",
"index": 0
}
]
]
},
"If file too large": {
"main": [
[
{
"node": "Get file",
"type": "main",
"index": 0
}
],
[
{
"node": "Merge Items",
"type": "main",
"index": 0
}
]
]
},
"Edit existing file": {
"main": [
[
{
"node": "Return",
"type": "main",
"index": 0
}
]
]
},
"Inform Failed Flows": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"verifyTheDifference": {
"main": [
[
{
"node": "Create sub path",
"type": "main",
"index": 0
}
]
]
},
"Inform Success Flows": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"On clicking 'execute'": {
"main": [
[
{
"node": "Starting Message",
"type": "main",
"index": 0
}
]
]
},
"Same file - Do nothing": {
"main": [
[
{
"node": "Return",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow Trigger": {
"main": [
[
{
"node": "Config",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
discordBotApigithubApin8nApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow will backup all of your existed workflows to a single Github repository.
Source: https://n8n.io/workflows/3990/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Back Up Your N8N Workflows To Github. Uses manualTrigger, stickyNote, executeWorkflowTrigger, n8n. Event-driven trigger; 26 nodes.
This workflow will backup your workflows to Github. It uses the public api to export all of the workflow data using the n8n node.
Stop the panic attacks. We've all been there - accidentally deleted a workflow that took hours to build, or worse, corrupted your entire automation setup. This workflow is your safety net.
Unlock low-cost, high-control generative media workflows directly from n8n by integrating with ComfyUI. Ideal for indie creators, AI developers, or small teams seeking scalable media automation—from i
This template is ideal for DevOps engineers, automation specialists, and n8n users who manage multiple workflows and want a reliable version control system for backups. It’s especially useful for team