n8n Workflow Backup to GitHub: Automate Your Flow Saves

Struggling to manually backup hundreds of n8n workflows? This automation compares your workflows with GitHub files, updating only changed or new ones, ensuring safe, organized backups. Save hours and secure your workflows effortlessly.
github
slack
executeWorkflow
+13
Workflow Identifier: 1110
NODES in Use: Manual Trigger, Sticky Note, Execute Workflow Trigger, n8n, Set, HTTP Request, If, Merge, Code, Switch, NoOp, GitHub, SplitInBatches, Schedule Trigger, Slack, Execute Workflow

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Workflow Does

This workflow automatically backs up all the workflows from an n8n instance to a GitHub repository every day. It solves the problem of manual backup tasks that take time and risk losing data. The workflow compares each workflow’s current version with the saved version in GitHub to avoid unnecessary uploads, organizing backups by year and month folders.

The result is a quick, automatic backup process that saves time and prevents errors.


Who Should Use This Workflow

Anyone managing many n8n workflows and needing regular safe backups should use this. It is useful for n8n instance admins who want to avoid manual backup errors and keep their workflows organized by date. It works well even if there are over 1,000 workflows, thanks to batch processing and recursive subflows.


Tools and Services Used

  • n8n: Automation platform to run the workflow.
  • GitHub API: Stores workflow JSON files in a repository.
  • Slack API (optional): Sends notifications about backup start, success, or failures.
  • HTTP Request node: Handles large file fetches in GitHub.

Inputs, Processing, and Outputs

Inputs

Processing Steps

  • The workflow triggers daily via Schedule Trigger.
  • Sends Slack message to notify start.
  • Fetches all workflows from n8n using the n8n API node.
  • Splits the workflows into batches using SplitInBatches for manageable processing.
  • Calls a subworkflow for each workflow to process individually.
  • Checks for the existing backup file in GitHub using a path based on creation date.
  • If file is missing or empty, uses HTTP Request node to fetch the file correctly.
  • Compares workflow JSON content inside Code node to classify the file as same, new, or different.
  • Creates or updates the backup file in GitHub accordingly with commit messages summarizing the action.
  • Sends Slack messages for completion or failure of backups.

Outputs

  • Organized backups in GitHub folder structure by year and month.
  • Slack notifications about process status.
  • Logs of backup success and failure recorded in n8n.

Beginner step-by-step: How to Use This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open the n8n editor and choose “Import from File”.
  3. Select and import the downloaded workflow file.

Step 2: Add Credentials

  1. Configure your n8n admin API credentials inside the n8n API node.
  2. Set GitHub API credentials with proper repo access for backup nodes.
  3. Optionally, set Slack webhook credentials in Slack nodes for notifications.

Step 3: Update Parameters

  1. Check and update folder paths, Slack channel IDs, or other settings as needed.
  2. If needed, adjust batch size in SplitInBatches node for your server.

Step 4: Test the Workflow

  1. Run the workflow once manually to verify correct operation.
  2. Look for Slack notification and GitHub commits confirming backups.

Step 5: Activate Backup Schedule

  1. Enable the Schedule Trigger node to start automatic daily backups.
  2. Monitor n8n execution logs and Slack messages for backup health.

Edge Cases and Failure Handling

If GitHub file access fails due to permissions, errors show in logs and Slack notifies with failed workflow IDs.

Batch size too large may cause out-of-memory errors; reduce batch size in SplitInBatches.

Scheduling mistakes cause missed backups if Schedule Trigger node is not enabled.

GitHub API rate limits might delay uploads; plan API usage or implement retries.


Customization Ideas

  • Change backup frequency by adjusting Schedule Trigger node settings.
  • Customize GitHub folder structure by editing the code in Set node that builds subpaths.
  • Modify Slack notification channels by changing the channel IDs in Slack nodes.
  • Add error handling in Execute Workflow node to stop or continue on failures.
  • Enhance version comparison logic by updating the Code node to add extra metadata to commits.

Summary

✓ Automates daily backups of all n8n workflows into GitHub.

✓ Prevents manual errors and saves over 15 minutes per backup.

✓ Organizes backup files into year/month folders for easy access.

✓ Sends Slack notifications to inform about backup start, success, and failures.

✓ Handles large workflow counts by batch processing and recursive calls.

Frequently Asked Questions

GitHub credentials must have read and write access to the repository with ‘repo’ scope enabled to read existing files and commit backups.
Make sure the Schedule Trigger node is enabled in n8n and the configured time and timezone settings match your requirements.
Empty uploads happen if large files are not properly fetched. The workflow fixes this using an HTTP Request node triggered by a check for missing content.
The workflow is built specifically for GitHub API. Using other systems requires redesigning file management and authentication nodes.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free