Operations & Systems
Backup n8n to Github | Subflow
This n8n subflow automates backing up n8n workflows to GitHub. It compares the current workflow with its GitHub backup: if new, it creates a file; if modified, it updates; if identical, it skips. Workflow tags determine the GitHub folder path.
Built · ~4.5 hours saved per week
Backup n8n Workflows to GitHub
Overview
This n8n subflow provides a reliable, automated solution for backing up n8n workflows to a GitHub repository. It acts as a version control system for your automations, checking if a workflow has been updated since its last backup and only committing the changes if necessary. This creates a full change history, enables disaster recovery, and facilitates collaboration by tracking modifications over time.
The workflow is designed to be called by another "parent" workflow (e.g., one that runs on a schedule), receiving a specific workflow's data, and then intelligently managing its backup file in GitHub.
Technologies Used
- n8n: The core automation platform executing the logic. - GitHub: Used as a remote data store and version control system for the workflow backup files.
Automation & Value
This subflow automates the critical but often manual task of backing up and versioning n8n workflows. The key value it provides is:
- Change Tracking: By comparing the current workflow with the version stored in GitHub, it only creates a new commit when actual changes have occurred. This builds a meaningful commit history that reflects the evolution of your automation. - Disaster Recovery: If a workflow is accidentally deleted or broken, a previous working version can be easily restored from the GitHub repository. - Automated Organization: It can automatically organize backups into folders within the repository based on the n8n tags assigned to the workflow, keeping your backups tidy and easy to navigate. - Efficiency: It avoids unnecessary operations. If a workflow hasn't changed, the flow simply stops, saving on API calls and execution time.
Node-by-Node Analysis
1. Execute Workflow Trigger
- Purpose: This is the entry point for the subflow. It's designed to receive the JSON data of a single n8n workflow that is passed to it from a parent workflow. - Function: It captures the incoming workflow data, making it available to the subsequent nodes.
2. tag? (Switch Node)
- Purpose: To determine if the incoming workflow has a tag, which will be used for organizational purposes in the GitHub repository.
Tags: Admin, n8n, Data Transformation
Integrations: HTTP, Code