AutomationFlowsDevOps › Backup Workflows to Github (proper Names)

Backup Workflows to Github (proper Names)

Backup Workflows To Github (Proper Names). Uses github, n8n. Scheduled trigger; 11 nodes.

Cron / scheduled trigger★★★★☆ complexity11 nodesGitHubn8n
DevOps Trigger: Cron / scheduled Nodes: 11 Complexity: ★★★★☆ Added:

This workflow follows the GitHub → n8n 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 →

Download .json
{
  "updatedAt": "2025-12-23T01:51:31.152Z",
  "createdAt": "2025-12-11T00:55:14.379Z",
  "id": "Mu7fMoOkpLXeZKCU",
  "name": "Backup Workflows To Github (Proper Names)",
  "active": true,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c1235fed-ae2f-4520-9158-2cf406bb2586",
              "leftValue": "={{ $('List Workflow Files on Github').all().map(item => item.json.name) }}",
              "rightValue": "={{ $json.name }}",
              "operator": {
                "type": "array",
                "operation": "contains",
                "rightType": "any"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -864,
        208
      ],
      "id": "8d0edd38-7250-47ea-9fa2-636a8ec411fd",
      "name": "If File Exists"
    },
    {
      "parameters": {
        "operation": "fromJson",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        -416,
        112
      ],
      "id": "9cb3dd8f-b506-402b-a9ad-2882fec0a56c",
      "name": "Extract from File"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -1760,
        208
      ],
      "id": "efc5c5d3-170c-436d-a3af-70a6f546e80b",
      "name": "Run Daily"
    },
    {
      "parameters": {
        "resource": "file",
        "operation": "list",
        "owner": {
          "__rl": true,
          "value": "adamhaley",
          "mode": "name"
        },
        "repository": {
          "__rl": true,
          "value": "megyk-automations",
          "mode": "list",
          "cachedResultName": "megyk-automations",
          "cachedResultUrl": "https://github.com/adamhaley/megyk-automations"
        },
        "filePath": "workflows"
      },
      "type": "n8n-nodes-base.github",
      "typeVersion": 1,
      "position": [
        -1536,
        208
      ],
      "id": "7d905908-8178-4b7e-8b01-7f658f217b73",
      "name": "List Workflow Files on Github",
      "executeOnce": true,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet name =  $json.name.replace(/ /g,'_');\nname = name.replace('/','') + '.json';\nreturn { name: name }"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -1088,
        208
      ],
      "id": "d1361a36-8b99-4a17-bb5e-a1ec0a5da4a6",
      "name": "Proper filename from Workflow",
      "executeOnce": false
    },
    {
      "parameters": {
        "resource": "file",
        "operation": "get",
        "owner": {
          "__rl": true,
          "value": "adamhaley",
          "mode": "name"
        },
        "repository": {
          "__rl": true,
          "value": "megyk-automations",
          "mode": "list",
          "cachedResultName": "megyk-automations",
          "cachedResultUrl": "https://github.com/adamhaley/megyk-automations"
        },
        "filePath": "=workflows/{{ $json.name }}",
        "additionalParameters": {}
      },
      "type": "n8n-nodes-base.github",
      "typeVersion": 1,
      "position": [
        -640,
        112
      ],
      "id": "56a6ffee-3232-4313-b134-714b68f03f20",
      "name": "Get The File",
      "executeOnce": false,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "filters": {
          "activeWorkflows": true,
          "tags": ""
        },
        "requestOptions": {}
      },
      "type": "n8n-nodes-base.n8n",
      "typeVersion": 1,
      "position": [
        -1312,
        208
      ],
      "id": "7c7d2d3d-879a-4819-abca-77aa5cd2db5e",
      "name": "n8n Get Active Workflows",
      "executeOnce": true,
      "credentials": {
        "n8nApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "file",
        "owner": {
          "__rl": true,
          "value": "adamhaley",
          "mode": "name"
        },
        "repository": {
          "__rl": true,
          "value": "megyk-automations",
          "mode": "list",
          "cachedResultName": "megyk-automations",
          "cachedResultUrl": "https://github.com/adamhaley/megyk-automations"
        },
        "filePath": "=workflows/{{$json.name  }}",
        "fileContent": "={{ JSON.stringify( $('n8n Get Active Workflows').item.json, null, 2 ) }}",
        "commitMessage": "=creating backup file for workflow \"{{ $('n8n Get Active Workflows').item.json.name }}\"\"",
        "additionalParameters": {
          "branch": {
            "branch": "main"
          }
        }
      },
      "type": "n8n-nodes-base.github",
      "typeVersion": 1,
      "position": [
        -640,
        304
      ],
      "id": "8186f6a2-e2aa-49fd-96d5-3419986f2697",
      "name": "Create File on Github",
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "resource": "file",
        "operation": "edit",
        "owner": {
          "__rl": true,
          "value": "adamhaley",
          "mode": "name"
        },
        "repository": {
          "__rl": true,
          "value": "megyk-automations",
          "mode": "list",
          "cachedResultName": "megyk-automations",
          "cachedResultUrl": "https://github.com/adamhaley/megyk-automations"
        },
        "filePath": "=workflows/{{ $('Get The File').item.json.name }}",
        "fileContent": "={{ JSON.stringify( $('n8n Get Active Workflows').item.json, null, 2 ) }}",
        "commitMessage": "=Updating n8n workflow \"{{ $('n8n Get Active Workflows').item.json.name }}\""
      },
      "type": "n8n-nodes-base.github",
      "typeVersion": 1,
      "position": [
        32,
        16
      ],
      "id": "e763d77c-5297-42cc-a652-f11059c5c405",
      "name": "Update File on GIthub",
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c9576a13-befb-4a51-85e2-7ee04cb3664f",
              "leftValue": "={{ JSON.stringify( $('Extract from File').item.json.data, null, 2 ) }}",
              "rightValue": "={{ JSON.stringify( $('n8n Get Active Workflows').item.json, null, 2 ) }}",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -192,
        112
      ],
      "id": "0ab5212b-fe76-4b91-9ab8-2c78f0322673",
      "name": "if n8n Workflow has Updates"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        32,
        208
      ],
      "id": "de2d2481-13f1-47a7-a93a-24ba14949e91",
      "name": "No Operation, do nothing"
    }
  ],
  "connections": {
    "If File Exists": {
      "main": [
        [
          {
            "node": "Get The File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create File on Github",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "if n8n Workflow has Updates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Daily": {
      "main": [
        [
          {
            "node": "List Workflow Files on Github",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Workflow Files on Github": {
      "main": [
        [
          {
            "node": "n8n Get Active Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Proper filename from Workflow": {
      "main": [
        [
          {
            "node": "If File Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get The File": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "n8n Get Active Workflows": {
      "main": [
        [
          {
            "node": "Proper filename from Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update File on GIthub": {
      "main": [
        [],
        []
      ]
    },
    "Create File on Github": {
      "main": [
        []
      ]
    },
    "if n8n Workflow has Updates": {
      "main": [
        [
          {
            "node": "Update File on GIthub",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "timeSavedMode": "fixed",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "errorWorkflow": "WbISMAIlclQfzorG"
  },
  "staticData": {
    "node:Run Daily": {
      "recurrenceRules": []
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "f3c47bee-22de-4348-88eb-dc30f2553488",
  "activeVersionId": "f3c47bee-22de-4348-88eb-dc30f2553488",
  "triggerCount": 1,
  "shared": [
    {
      "updatedAt": "2025-12-11T00:55:14.388Z",
      "createdAt": "2025-12-11T00:55:14.388Z",
      "role": "workflow:owner",
      "workflowId": "Mu7fMoOkpLXeZKCU",
      "projectId": "B7QJE85HA2Vij1it"
    }
  ],
  "activeVersion": {
    "updatedAt": "2025-12-23T01:51:33.000Z",
    "createdAt": "2025-12-21T17:19:52.286Z",
    "versionId": "f3c47bee-22de-4348-88eb-dc30f2553488",
    "workflowId": "Mu7fMoOkpLXeZKCU",
    "nodes": [
      {
        "parameters": {
          "conditions": {
            "options": {
              "caseSensitive": true,
              "leftValue": "",
              "typeValidation": "strict",
              "version": 2
            },
            "conditions": [
              {
                "id": "c1235fed-ae2f-4520-9158-2cf406bb2586",
                "leftValue": "={{ $('List Workflow Files on Github').all().map(item => item.json.name) }}",
                "rightValue": "={{ $json.name }}",
                "operator": {
                  "type": "array",
                  "operation": "contains",
                  "rightType": "any"
                }
              }
            ],
            "combinator": "and"
          },
          "options": {}
        },
        "type": "n8n-nodes-base.if",
        "typeVersion": 2.2,
        "position": [
          -864,
          208
        ],
        "id": "8d0edd38-7250-47ea-9fa2-636a8ec411fd",
        "name": "If File Exists"
      },
      {
        "parameters": {
          "operation": "fromJson",
          "options": {}
        },
        "type": "n8n-nodes-base.extractFromFile",
        "typeVersion": 1,
        "position": [
          -416,
          112
        ],
        "id": "9cb3dd8f-b506-402b-a9ad-2882fec0a56c",
        "name": "Extract from File"
      },
      {
        "parameters": {
          "rule": {
            "interval": [
              {}
            ]
          }
        },
        "type": "n8n-nodes-base.scheduleTrigger",
        "typeVersion": 1.2,
        "position": [
          -1760,
          208
        ],
        "id": "efc5c5d3-170c-436d-a3af-70a6f546e80b",
        "name": "Run Daily"
      },
      {
        "parameters": {
          "resource": "file",
          "operation": "list",
          "owner": {
            "__rl": true,
            "value": "adamhaley",
            "mode": "name"
          },
          "repository": {
            "__rl": true,
            "value": "megyk-automations",
            "mode": "list",
            "cachedResultName": "megyk-automations",
            "cachedResultUrl": "https://github.com/adamhaley/megyk-automations"
          },
          "filePath": "workflows"
        },
        "type": "n8n-nodes-base.github",
        "typeVersion": 1,
        "position": [
          -1536,
          208
        ],
        "id": "7d905908-8178-4b7e-8b01-7f658f217b73",
        "name": "List Workflow Files on Github",
        "executeOnce": true,
        "webhookId": "ef7828ec-cf4d-42a9-b12f-5c088cf829ec",
        "credentials": {
          "githubApi": {
            "id": "2omAzGRnpCrb3ZGb",
            "name": "GitHub account"
          }
        }
      },
      {
        "parameters": {
          "mode": "runOnceForEachItem",
          "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet name =  $json.name.replace(/ /g,'_');\nname = name.replace('/','') + '.json';\nreturn { name: name }"
        },
        "type": "n8n-nodes-base.code",
        "typeVersion": 2,
        "position": [
          -1088,
          208
        ],
        "id": "d1361a36-8b99-4a17-bb5e-a1ec0a5da4a6",
        "name": "Proper filename from Workflow",
        "executeOnce": false
      },
      {
        "parameters": {
          "resource": "file",
          "operation": "get",
          "owner": {
            "__rl": true,
            "value": "adamhaley",
            "mode": "name"
          },
          "repository": {
            "__rl": true,
            "value": "megyk-automations",
            "mode": "list",
            "cachedResultName": "megyk-automations",
            "cachedResultUrl": "https://github.com/adamhaley/megyk-automations"
          },
          "filePath": "=workflows/{{ $json.name }}",
          "additionalParameters": {}
        },
        "type": "n8n-nodes-base.github",
        "typeVersion": 1,
        "position": [
          -640,
          112
        ],
        "id": "56a6ffee-3232-4313-b134-714b68f03f20",
        "name": "Get The File",
        "executeOnce": false,
        "webhookId": "c6bcc826-6787-45c1-a756-6aedb5fd81b7",
        "credentials": {
          "githubApi": {
            "id": "2omAzGRnpCrb3ZGb",
            "name": "GitHub account"
          }
        }
      },
      {
        "parameters": {
          "filters": {
            "activeWorkflows": true,
            "tags": ""
          },
          "requestOptions": {}
        },
        "type": "n8n-nodes-base.n8n",
        "typeVersion": 1,
        "position": [
          -1312,
          208
        ],
        "id": "7c7d2d3d-879a-4819-abca-77aa5cd2db5e",
        "name": "n8n Get Active Workflows",
        "executeOnce": true,
        "credentials": {
          "n8nApi": {
            "id": "lo23nGVR8nVRtIwQ",
            "name": "n8n account"
          }
        }
      },
      {
        "parameters": {
          "resource": "file",
          "owner": {
            "__rl": true,
            "value": "adamhaley",
            "mode": "name"
          },
          "repository": {
            "__rl": true,
            "value": "megyk-automations",
            "mode": "list",
            "cachedResultName": "megyk-automations",
            "cachedResultUrl": "https://github.com/adamhaley/megyk-automations"
          },
          "filePath": "=workflows/{{$json.name  }}",
          "fileContent": "={{ JSON.stringify( $('n8n Get Active Workflows').item.json, null, 2 ) }}",
          "commitMessage": "=creating backup file for workflow \"{{ $('n8n Get Active Workflows').item.json.name }}\"\"",
          "additionalParameters": {
            "branch": {
              "branch": "main"
            }
          }
        },
        "type": "n8n-nodes-base.github",
        "typeVersion": 1,
        "position": [
          -640,
          304
        ],
        "id": "8186f6a2-e2aa-49fd-96d5-3419986f2697",
        "name": "Create File on Github",
        "webhookId": "23889cba-d3e7-4dd0-ab91-4b262d0112f1",
        "credentials": {
          "githubApi": {
            "id": "2omAzGRnpCrb3ZGb",
            "name": "GitHub account"
          }
        },
        "onError": "continueRegularOutput"
      },
      {
        "parameters": {
          "resource": "file",
          "operation": "edit",
          "owner": {
            "__rl": true,
            "value": "adamhaley",
            "mode": "name"
          },
          "repository": {
            "__rl": true,
            "value": "megyk-automations",
            "mode": "list",
            "cachedResultName": "megyk-automations",
            "cachedResultUrl": "https://github.com/adamhaley/megyk-automations"
          },
          "filePath": "=workflows/{{ $('Get The File').item.json.name }}",
          "fileContent": "={{ JSON.stringify( $('n8n Get Active Workflows').item.json, null, 2 ) }}",
          "commitMessage": "=Updating n8n workflow \"{{ $('n8n Get Active Workflows').item.json.name }}\""
        },
        "type": "n8n-nodes-base.github",
        "typeVersion": 1,
        "position": [
          32,
          16
        ],
        "id": "e763d77c-5297-42cc-a652-f11059c5c405",
        "name": "Update File on GIthub",
        "webhookId": "f6489b4e-6185-449d-b876-e17fd2afbbd1",
        "credentials": {
          "githubApi": {
            "id": "2omAzGRnpCrb3ZGb",
            "name": "GitHub account"
          }
        },
        "onError": "continueErrorOutput"
      },
      {
        "parameters": {
          "conditions": {
            "options": {
              "caseSensitive": true,
              "leftValue": "",
              "typeValidation": "strict",
              "version": 2
            },
            "conditions": [
              {
                "id": "c9576a13-befb-4a51-85e2-7ee04cb3664f",
                "leftValue": "={{ JSON.stringify( $('Extract from File').item.json.data, null, 2 ) }}",
                "rightValue": "={{ JSON.stringify( $('n8n Get Active Workflows').item.json, null, 2 ) }}",
                "operator": {
                  "type": "string",
                  "operation": "notEquals"
                }
              }
            ],
            "combinator": "and"
          },
          "options": {}
        },
        "type": "n8n-nodes-base.if",
        "typeVersion": 2.2,
        "position": [
          -192,
          112
        ],
        "id": "0ab5212b-fe76-4b91-9ab8-2c78f0322673",
        "name": "if n8n Workflow has Updates"
      },
      {
        "parameters": {},
        "type": "n8n-nodes-base.noOp",
        "typeVersion": 1,
        "position": [
          32,
          208
        ],
        "id": "de2d2481-13f1-47a7-a93a-24ba14949e91",
        "name": "No Operation, do nothing"
      }
    ],
    "connections": {
      "If File Exists": {
        "main": [
          [
            {
              "node": "Get The File",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "Create File on Github",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Extract from File": {
        "main": [
          [
            {
              "node": "if n8n Workflow has Updates",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Run Daily": {
        "main": [
          [
            {
              "node": "List Workflow Files on Github",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "List Workflow Files on Github": {
        "main": [
          [
            {
              "node": "n8n Get Active Workflows",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Proper filename from Workflow": {
        "main": [
          [
            {
              "node": "If File Exists",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Get The File": {
        "main": [
          [
            {
              "node": "Extract from File",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "n8n Get Active Workflows": {
        "main": [
          [
            {
              "node": "Proper filename from Workflow",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Update File on GIthub": {
        "main": [
          [],
          []
        ]
      },
      "Create File on Github": {
        "main": [
          []
        ]
      },
      "if n8n Workflow has Updates": {
        "main": [
          [
            {
              "node": "Update File on GIthub",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "No Operation, do nothing",
              "type": "main",
              "index": 0
            }
          ]
        ]
      }
    },
    "nodeGroups": [],
    "authors": "Gordan Kljajic",
    "name": "Version f3c47bee",
    "description": "",
    "autosaved": false
  },
  "tags": []
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Backup Workflows To Github (Proper Names). Uses github, n8n. Scheduled trigger; 11 nodes.

Source: https://github.com/adamhaley/megyk-automations/blob/main/workflows/Backup_Workflows_To_Github_(Proper_Names).json — original creator credit. Request a take-down →

More DevOps workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

DevOps

Who is this for? This template is ideal for n8n administrators, automation engineers, and DevOps teams who want to maintain bidirectional synchronization between their n8n workflows and GitHub reposit

n8n, GitHub
DevOps

Automatically back up and sync your n8n workflows to GitHub with unlimited version control. This workflow ensures your repository always reflects the latest state of your n8n instance by creating, upd

GitHub, n8n
DevOps

github_fluxo. Uses moveBinaryData, n8n, github. Scheduled trigger; 19 nodes.

Move Binary Data, n8n, GitHub
DevOps

[Gus] Backup workflows in github. Uses github, itemLists, n8n, moveBinaryData. Scheduled trigger; 18 nodes.

GitHub, Item Lists, n8n +1
DevOps

Backup workflows to git repository. Uses github, n8n, splitInBatches, scheduleTrigger. Scheduled trigger; 17 nodes.

GitHub, n8n