This workflow corresponds to n8n.io template #2652 — we link there as the canonical source.
This workflow follows the Execute Workflow Trigger → HTTP Request recipe pattern — see all workflows that pair these two integrations.
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 →
{
"nodes": [
{
"id": "a132fc4c-b651-4ca1-8c36-c925188835db",
"name": "On clicking 'execute'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
320,
60
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9a3870e1-e79d-461e-885a-f2e79d76f4e1",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-120,
440
],
"parameters": {
"color": 6,
"width": 2086.845881354743,
"height": 750.8363163824032,
"content": "## Subworkflow"
},
"typeVersion": 1
},
{
"id": "afaf95c7-5f2b-4ae2-a7de-8730f839d79f",
"name": "n8n",
"type": "n8n-nodes-base.n8n",
"position": [
580,
160
],
"parameters": {
"filters": {},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "e582f9cb-10e0-44c5-ab9b-b5e20aa49ced",
"name": "Return",
"type": "n8n-nodes-base.set",
"position": [
1760,
640
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8d513345-6484-431f-afb7-7cf045c90f4f",
"name": "Done",
"type": "boolean",
"value": true
}
]
}
},
"typeVersion": 3.3
},
{
"id": "3d0b2d17-0e05-4139-b99c-e1cb862f2f9b",
"name": "Get File",
"type": "n8n-nodes-base.httpRequest",
"position": [
860,
520
],
"parameters": {
"url": "={{ $json.download_url }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "9dcdd75d-671a-4a85-8618-2fbbd8158a86",
"name": "If file too large",
"type": "n8n-nodes-base.if",
"position": [
660,
540
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "45ce825e-9fa6-430c-8931-9aaf22c42585",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.content }}",
"rightValue": ""
},
{
"id": "9619a55f-7fb1-4f24-b1a7-7aeb82365806",
"operator": {
"type": "string",
"operation": "notExists",
"singleValue": true
},
"leftValue": "={{ $json.error }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2
},
{
"id": "1b6153ae-797a-4e3d-80c6-01467809b9ec",
"name": "Merge Items",
"type": "n8n-nodes-base.merge",
"position": [
660,
800
],
"parameters": {},
"typeVersion": 2
},
{
"id": "edba838c-2d9d-45e9-b4f7-340209dfec8d",
"name": "isDiffOrNew",
"type": "n8n-nodes-base.code",
"position": [
860,
800
],
"parameters": {
"jsCode": "const orderJsonKeys = (jsonObj) => {\n const ordered = {};\n Object.keys(jsonObj).sort().forEach(key => {\n ordered[key] = jsonObj[key];\n });\n return ordered;\n}\n\n// Check if file returned with content\nif (Object.keys($input.all()[0].json).includes(\"content\")) {\n // Decode base64 content and parse JSON\n const origWorkflow = JSON.parse(Buffer.from($input.all()[0].json.content, 'base64').toString());\n const n8nWorkflow = $input.all()[1].json;\n \n // Order JSON objects\n const orderedOriginal = orderJsonKeys(origWorkflow);\n const orderedActual = orderJsonKeys(n8nWorkflow);\n\n // Determine difference\n if (JSON.stringify(orderedOriginal) === JSON.stringify(orderedActual)) {\n $input.all()[0].json.github_status = \"same\";\n } else {\n $input.all()[0].json.github_status = \"different\";\n $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n }\n $input.all()[0].json.content_decoded = orderedOriginal;\n// No file returned / new workflow\n} else if (Object.keys($input.all()[0].json).includes(\"data\")) {\n const origWorkflow = JSON.parse($input.all()[0].json.data);\n const n8nWorkflow = $input.all()[1].json;\n \n // Order JSON objects\n const orderedOriginal = orderJsonKeys(origWorkflow);\n const orderedActual = orderJsonKeys(n8nWorkflow);\n\n // Determine difference\n if (JSON.stringify(orderedOriginal) === JSON.stringify(orderedActual)) {\n $input.all()[0].json.github_status = \"same\";\n } else {\n $input.all()[0].json.github_status = \"different\";\n $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n }\n $input.all()[0].json.content_decoded = orderedOriginal;\n\n} else {\n // Order JSON object\n const n8nWorkflow = $input.all()[1].json;\n const orderedActual = orderJsonKeys(n8nWorkflow);\n \n // Proper formatting\n $input.all()[0].json.github_status = \"new\";\n $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n}\n\n// Return items\nreturn $input.all();"
},
"typeVersion": 1
},
{
"id": "4f4193f2-bb76-4af7-8a6a-c15e29732208",
"name": "Check Status",
"type": "n8n-nodes-base.switch",
"position": [
1080,
800
],
"parameters": {
"rules": {
"rules": [
{
"value2": "same"
},
{
"output": 1,
"value2": "different"
},
{
"output": 2,
"value2": "new"
}
]
},
"value1": "={{$json.github_status}}",
"dataType": "string"
},
"typeVersion": 1
},
{
"id": "1c31cc43-48a3-4716-82a8-6a920662c0ed",
"name": "Same file - Do nothing",
"type": "n8n-nodes-base.noOp",
"position": [
1300,
640
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c24abb49-6a5e-41db-9e32-0efd682bb440",
"name": "File is different",
"type": "n8n-nodes-base.noOp",
"position": [
1300,
800
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f2ec4b61-8193-49e4-829b-e42bcaafef08",
"name": "File is new",
"type": "n8n-nodes-base.noOp",
"position": [
1300,
960
],
"parameters": {},
"typeVersion": 1
},
{
"id": "af0d0e28-5ed7-4ab8-b1a4-e78567cdc747",
"name": "Create new file",
"type": "n8n-nodes-base.github",
"position": [
1520,
960
],
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $('Globals').item.json.repo.owner }}"
},
"filePath": "={{ $('Globals').item.json.repo.path }}{{$('Execute Workflow Trigger').first().json.id}}.json",
"resource": "file",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $('Globals').item.json.repo.name }}"
},
"fileContent": "={{$('isDiffOrNew').item.json[\"n8n_data_stringy\"]}}",
"commitMessage": "={{$('Execute Workflow Trigger').first().json.name}} ({{$json.github_status}})"
},
"credentials": {
"githubApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "f75605ee-10e8-4d45-b6c6-af2eb9b87a5b",
"name": "Edit existing file",
"type": "n8n-nodes-base.github",
"position": [
1520,
780
],
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $('Globals').item.json.repo.owner }}"
},
"filePath": "={{ $('Globals').item.json.repo.path }}{{$('Execute Workflow Trigger').first().json.id}}.json",
"resource": "file",
"operation": "edit",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $('Globals').item.json.repo.name }}"
},
"fileContent": "={{$('isDiffOrNew').item.json[\"n8n_data_stringy\"]}}",
"commitMessage": "={{$('Execute Workflow Trigger').first().json.name}} ({{$json.github_status}})"
},
"credentials": {
"githubApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "124e721b-6eac-476f-aa6d-edfe0dc6afa1",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
780,
160
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "132608d5-dc5e-4a11-9955-331b482fe442",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
320,
260
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 2
}
]
}
},
"typeVersion": 1.2
},
{
"id": "5ca560c0-b281-4bea-95bd-c8decd2bb8ee",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-120,
-200
],
"parameters": {
"color": 4,
"width": 371,
"height": 601,
"content": "## Backup to GitHub \nThis workflow will backup all instance workflows to GitHub.\n\nThe files are saved `ID.json` for the filename.\n\n### Setup\nOpen `Globals` node and update the values below \ud83d\udc47\n\n- **repo.owner:** your Github username\n- **repo.name:** the name of your repository\n- **repo.path:** the folder to use within the repository. If it doesn't exist it will be created.\n\n\nIf your username was `john-doe` and your repository was called `n8n-backups` and you wanted the workflows to go into a `workflows` folder you would set:\n\n- repo.owner - john-doe\n- repo.name - n8n-backups\n- repo.path - workflows/\n\n\nThe workflow calls itself using a subworkflow, to help reduce memory usage."
},
"typeVersion": 1
},
{
"id": "26e38d41-f253-4fa2-964f-54f8b468d211",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
280,
-20
],
"parameters": {
"color": 7,
"width": 886,
"height": 435,
"content": "## Main workflow loop"
},
"typeVersion": 1
},
{
"id": "0dfdc6cc-616e-447a-b1cb-45f116894509",
"name": "Get file data",
"type": "n8n-nodes-base.github",
"position": [
460,
540
],
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo.owner }}"
},
"filePath": "={{ $json.repo.path }}{{ $('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": "351f9282-202a-4984-89b3-020c981b309f",
"name": "Globals",
"type": "n8n-nodes-base.set",
"position": [
240,
700
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "6cf546c5-5737-4dbd-851b-17d68e0a3780",
"name": "repo.owner",
"type": "string",
"value": "john-doe"
},
{
"id": "452efa28-2dc6-4ea3-a7a2-c35d100d0382",
"name": "repo.name",
"type": "string",
"value": "n8n-backup"
},
{
"id": "81c4dc54-86bf-4432-a23f-22c7ea831e74",
"name": "repo.path",
"type": "string",
"value": "workflows/"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ffe9f716-11de-46b0-8221-ab4addc6ea1c",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
200,
600
],
"parameters": {
"color": 4,
"width": 150,
"height": 80,
"content": "## Edit this node \ud83d\udc47"
},
"typeVersion": 1
},
{
"id": "72616fc1-1c21-4f17-862c-2838636437ec",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-40,
820
],
"parameters": {
"inputSource": "passthrough"
},
"typeVersion": 1.1
},
{
"id": "9496f6d1-1fcb-4b31-9a80-8f0c15c426f8",
"name": "Execute Workflow",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
1000,
160
],
"parameters": {
"mode": "each",
"options": {},
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $workflow.id }}"
},
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2
},
{
"id": "015a5f28-d1ff-4e3b-a303-6d143c7326b1",
"name": "Sticky Note16",
"type": "n8n-nodes-base.stickyNote",
"position": [
280,
-200
],
"parameters": {
"color": 4,
"width": 640,
"content": "### \ud83d\udca1 **Want to learn advanced n8n skills and earn money building workflows?**\n\u200e \u200e \u200e \u200e \u200e \u200e \u200e \u200eCheck out [Scrapes Academy](https://www.skool.com/scrapes/about?ref=21f10ad99f4d46ba9b8aaea8c9f58c34)"
},
"typeVersion": 1
}
],
"connections": {
"n8n": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Globals": {
"main": [
[
{
"node": "Get file data",
"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": "isDiffOrNew",
"type": "main",
"index": 0
}
]
]
},
"isDiffOrNew": {
"main": [
[
{
"node": "Check Status",
"type": "main",
"index": 0
}
]
]
},
"Check Status": {
"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 data": {
"main": [
[
{
"node": "If file too large",
"type": "main",
"index": 0
}
]
]
},
"Create new file": {
"main": [
[
{
"node": "Return",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Execute Workflow",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"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
}
]
]
},
"On clicking 'execute'": {
"main": [
[
{
"node": "n8n",
"type": "main",
"index": 0
}
]
]
},
"Same file - Do nothing": {
"main": [
[
{
"node": "Return",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow Trigger": {
"main": [
[
{
"node": "Globals",
"type": "main",
"index": 0
},
{
"node": "Merge Items",
"type": "main",
"index": 1
}
]
]
}
}
}
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.
githubApin8nApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Based on Jonathan's work. Check out his templates.
Source: https://n8n.io/workflows/2652/ — 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.
Remixed Backup your workflows to GitHub from Solomon's work. Check out his templates.
Based on Jonathan & Solomon work.
Backup Workflows to GitHub. Uses n8n, httpRequest, github, executeWorkflowTrigger. Event-driven trigger; 24 nodes.
This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di
Git Commit. Uses github, n8n, formTrigger, httpRequest. Event-driven trigger; 34 nodes.