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! 🔄✨
📝 What This Workflow Does
- Schedules backups: Triggers the workflow automatically every 6 hours—no manual steps needed. ⏰
- Exports all current workflows: Collects a JSON snapshot of every workflow in your n8n instance. 📦
- Pushes backups to GitHub: Commits each backup file to your specified GitHub repository with a time-stamped commit message for easy tracking. 🗂️🚀
- Smart file handling: Checks if a backup file already exists and creates or updates as needed, keeping your repository clean and organized. 🤖
⚡️ Why Use This Template?
- Automate your workflow backups – never miss a backup again!
- Seamless integration with GitHub for team collaboration, change management, and rollback.
- Simple, reliable, and fully customizable to match your backup intervals and repository setup.
- Peace of mind that your critical automation assets are always protected.
📦 How the Template Works: Step-by-step Overview
- Scheduled Trigger: Fires every 6 hours to launch the backup sequence.
- Get All Workflows: Uses the n8n API credential to list each page of workflows and retrieve their full definitions.
- Build backup file: Converts the JSON into a binary format, ready for GitHub storage.
- Edit/Create Backup File: Looks up the backup path and creates a missing file or updates the existing file.
- Conditional Logic: Stops before writing if GitHub denies access to the backup path.
- Repeat: The process auto-loops every 6 hours—no further intervention required!
🔧 How To Set Up On Your Server
- Import the template into your n8n instance.
- Connect your GitHub credential to Check backup file, Create a file, and Edit a file.
- Set the owner, repository, and path in Repository settings. Choose a private repository if your workflow definitions contain internal details.
- Connect the same n8n API credential to Get All Workflows and Get Workflow Definition.
- Save and activate the workflow—now your backups are on autopilot!
👨💻 Example Use Cases
- Version control for rapidly changing automation environments.
- Safeguarding business-critical automation assets.
- Easy rollback in case of workflow corruption or accidental deletion.
- Team collaboration through GitHub's pull request and review process.
🌟 Pro Tips
- Adjust the backup interval in the
Schedule Trigger node if you require more/less frequent backups.
- Use GitHub branch protection rules for enhanced workflow security.
- Pair this backup workflow with notifications (e.g., Slack or Email) for backup alerts.
Protect your n8n workflows with automated, reliable, and versioned GitHub backups—set it and forget it! 🚦🔒