AutomationFlowsWeb Scraping › Automated Workflow Backup to Github on Schedule

Automated Workflow Backup to Github on Schedule

ByAkash Kankariya @akash25 on n8n.io

Easily ensure your n8n workflows are never lost! This template automates the process of backing up all your n8n workflows to a GitHub repository every 6 hours. Set it up once and enjoy worry-free workflow versioning and disaster recovery! 🔄✨ Schedules backups: Triggers the…

Cron / scheduled trigger★★★★☆ complexity10 nodesMove Binary DataGitHubHTTP Request
Web Scraping Trigger: Cron / scheduled Nodes: 10 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #6392 — we link there as the canonical source.

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

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "d413aa8d-5e9e-4d06-a4dc-4806d2cf656f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        -16
      ],
      "parameters": {
        "color": 2,
        "width": 763,
        "height": 316,
        "content": "## Backup every 6 Hour (can be changed as per requirement) "
      },
      "typeVersion": 1
    },
    {
      "id": "b2cc1790-3177-4ddd-bcd1-df8408ad7418",
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "position": [
        1712,
        64
      ],
      "parameters": {
        "mode": "jsonToBinary",
        "options": {
          "fileName": "=backup",
          "useRawData": true
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f2bd8590-ba99-4bff-a01e-f94306382bb3",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1200,
        64
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "44e5938e-5ec5-49b9-9b64-1d2f4507750a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -128
      ],
      "parameters": {
        "width": 720,
        "height": 1400,
        "content": "# \ud83d\ude80 Automated n8n Workflow Backup to GitHub for schedule Interval\n\nEasily ensure your n8n workflows are never lost! This template automates the process of backing up all your n8n workflows to a GitHub repository every 6 hours. Set it up once and enjoy *worry-free* workflow versioning and disaster recovery! \ud83d\udd04\u2728\n\n## \ud83d\udcdd What This Workflow Does\n\n- **Schedules backups**: Triggers the workflow automatically every 6 hours\u2014no manual steps needed. \u23f0\n- **Exports all current workflows**: Collects a JSON snapshot of every workflow in your n8n instance. \ud83d\udce6\n- **Pushes backups to GitHub**: Commits each backup file to your specified GitHub repository with a time-stamped commit message for easy tracking. \ud83d\uddc2\ufe0f\ud83d\ude80\n- **Smart file handling**: Checks if a backup file already exists and creates or updates as needed, keeping your repository clean and organized. \ud83e\udd16\n\n##\u26a1\ufe0f Why Use This Template?\n\n- **Automate your workflow backups \u2013 never miss a backup again!**\n- **Seamless integration with GitHub** for team collaboration, change management, and rollback.\n- **Simple, reliable, and fully customizable** to match your backup intervals and repository setup.\n- **Peace of mind** that your critical automation assets are always protected.\n\n## \ud83d\udce6 How the Template Works: Step-by-step Overview\n\n1. **Scheduled Trigger**: Fires every 6 hours to launch the backup sequence.\n2. **Get All Workflows**: Uses the `HTTP Request` node to fetch all n8n workflows from your instance as JSON data.\n3. **Move Binary Data**: Converts the JSON into a binary format, ready for GitHub storage.\n4. **Edit/Create Backup File**: Attempts to edit (update) an existing backup file in your GitHub repo. If the file does not exist, the workflow will create a new one.\n5. **Conditional Logic**: Checks after each run whether the backup file exists and ensures previous versions can be recovered or merged as needed.\n6. **Repeat**: The process auto-loops every 6 hours\u2014no further intervention required!\n\n## \ud83d\udd27 How To Set Up On Your Server\n\n1. **Import the template** into your n8n instance.\n2. **Configure your GitHub credentials** in the workflow nodes.\n3. **Update the GitHub repository details** (`owner`, `repository`, and `filePath`) to use your own repo and desired file path.\n4. **Set your n8n API key** and update the API endpoint URL to match your deployment.\n5. **Save and activate** the workflow\u2014now your backups are on autopilot!\n\n## \ud83d\udc68\u200d\ud83d\udcbb Example Use Cases\n\n- Version control for rapidly changing automation environments.\n- Safeguarding business-critical automation assets.\n- Easy rollback in case of workflow corruption or accidental deletion.\n- Team collaboration through GitHub's pull request and review process.\n\n## \ud83c\udf1f Pro Tips\n\n- Adjust the backup interval in the `Schedule Trigger` node if you require more/less frequent backups.\n- Use GitHub branch protection rules for enhanced workflow security.\n- Pair this backup workflow with notifications (e.g., Slack or Email) for backup alerts.\n\n**Protect your n8n workflows with automated, reliable, and versioned GitHub backups\u2014set it and forget it!** \ud83d\udea6\ud83d\udd12"
      },
      "typeVersion": 1
    },
    {
      "id": "9a65446c-1088-477d-b45e-892b65a78153",
      "name": "Edit a file",
      "type": "n8n-nodes-base.github",
      "onError": "continueErrorOutput",
      "position": [
        1984,
        64
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "github-profile-name"
        },
        "filePath": "backup.json",
        "resource": "file",
        "operation": "edit",
        "binaryData": true,
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "n8n_backup",
          "cachedResultUrl": "https://github.com/akashkankariya/n8n_backup",
          "cachedResultName": "n8n_backup"
        },
        "commitMessage": "=n8n_backup_{{ $now.format('yyyy-MM-dd hh') }}"
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "95b1d46c-6641-4b6f-805e-9847ec837878",
      "name": "Get All Workflows",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1472,
        64
      ],
      "parameters": {
        "url": "https://your-n8n-instance.com/rest/workflows?limit=9999",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            },
            {
              "name": "X-N8N-API-KEY",
              "value": "<n8n-api-key>"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "528b75d1-0c3a-4e42-bbcb-555f85d151ab",
      "name": "Create a file",
      "type": "n8n-nodes-base.github",
      "position": [
        2784,
        128
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "github-profile-name"
        },
        "filePath": "backup.json",
        "resource": "file",
        "binaryData": true,
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "n8n_backup",
          "cachedResultUrl": "https://github.com/akashkankariya/n8n_backup",
          "cachedResultName": "n8n_backup"
        },
        "commitMessage": "=n8n_backup_{{ $now.format('yyyy-MM-dd hh') }}"
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "f56f7667-d3d8-49ec-8c8c-d25a1ed67adc",
      "name": "If file not exits?",
      "type": "n8n-nodes-base.if",
      "position": [
        2320,
        192
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "dc419c30-f84f-493f-9125-3b60daeb4a4c",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": "The resource you are requesting could not be found"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9025fa65-9c6b-4f1e-898c-45679c720129",
      "name": "Get Previous FIle back",
      "type": "n8n-nodes-base.merge",
      "position": [
        2560,
        128
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "joinMode": "enrichInput1",
        "fieldsToMatchString": "data"
      },
      "typeVersion": 3.2
    },
    {
      "id": "41c7655b-5b7d-4f3b-8aca-ba56736d2ec6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1952,
        -16
      ],
      "parameters": {
        "color": 3,
        "width": 1063,
        "height": 356,
        "content": "## Check if File is present or not else it will create file a new file based on error"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Edit a file": {
      "main": [
        [],
        [
          {
            "node": "If file not exits?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a file": {
      "main": [
        []
      ]
    },
    "Move Binary Data": {
      "main": [
        [
          {
            "node": "Edit a file",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Previous FIle back",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get All Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Workflows": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If file not exits?": {
      "main": [
        [
          {
            "node": "Get Previous FIle back",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get Previous FIle back": {
      "main": [
        [
          {
            "node": "Create a file",
            "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.

Pro

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

About this workflow

Easily ensure your n8n workflows are never lost! This template automates the process of backing up all your n8n workflows to a GitHub repository every 6 hours. Set it up once and enjoy worry-free workflow versioning and disaster recovery! 🔄✨ Schedules backups: Triggers the…

Source: https://n8n.io/workflows/6392/ — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

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

Web Scraping

N8N-Workflow-Github-Manager. Uses github, httpRequest, n8n. Scheduled trigger; 38 nodes.

GitHub, HTTP Request, n8n
Web Scraping

Track Changes Of Product Prices. Uses htmlExtract, functionItem, httpRequest, writeBinaryFile. Scheduled trigger; 25 nodes.

Html Extract, Function Item, HTTP Request +5
Web Scraping

This workflow automatically tracks changes on specific websites, typically in e-commerce where you want to get information about price changes. Basic knowledge of HTML and JavaScript Execute Command n

Html Extract, Function Item, HTTP Request +5
Web Scraping

This workflow will gather data every minute from the GitHub (https://github.com), Docker (https://www.docker.com/), npm (https://www.npmjs.com/) and Product Hunt (https://www.producthunt.com/) website

HTTP Request, GitHub
Web Scraping

This workflow creates a versioned backup of an entire Clockify workspace split up into monthly reports. This backup routine runs daily by default The Clockify reports API endpoint is used to get all d

Stop And Error, Clockify, HTTP Request +1