Use this powerful n8n workflow to automatically backup all your n8n workflows to GitHub, ensuring version control and history. Features dynamic pathing and efficient difference checking.
Download this n8n workflow template and start using it instantly.
n8n administrators and DevOps teams requiring reliable version control for all production n8n workflow configurations.
Users looking for advanced n8n templates that utilize self-calling recursive workflows.
This is a critical maintenance n8n workflow solution designed for organizations running n8n in production. It addresses the challenge of workflow loss and configuration drift by providing robust, version-controlled backups of every n8n workflow file (ID.json) to GitHub. The system uses a sophisticated recursive n8n node approach to iteratively fetch and compare the current state of the running workflow against its stored version in the repository.
A key benefit of this n8n workflow is its efficiency. By employing a custom comparison logic within a dedicated Code n8n node, it only interacts with the GitHub API to perform an update if an actual functional difference is detected. This minimizes unnecessary API calls and ensures that your repository history is clean and meaningful. Using this n8n workflow as a foundation, you can guarantee your automation logic is consistently backed up and tracked.
The process is initiated either manually using the On clicking 'execute' n8n trigger or automatically via the Schedule Trigger n8n node (configured for a daily run, usually at 7 AM).
n8n n8n node retrieves a comprehensive list of all published workflows on the current instance.Loop Over Items n8n node and the subsequent Execute Workflow n8n node establish a self-calling, recursive loop. This pattern is implemented to handle hundreds of workflows efficiently by processing each item as a sub-workflow call.Globals n8n node defines the target GitHub parameters (owner, repo, and dynamic pathing based on workflow tags, handled by the preceding tag? and / n8n nodes). Get file data GitHub n8n node attempts to fetch the existing JSON file from the repository. Crucially, it continues on failure if the file is new. If the file is too large for a direct retrieval, If file too large routes the item to Get File (HTTP Request) to download the content via the provided URL.Merge Items node combines the workflow data and the GitHub file data. The isDiffOrNew Code n8n node then decodes the existing file content (if present), orders the keys in both the old and new JSON objects, and performs a comparison. It assigns a status: "same", "different", or "new".Check Status Switch n8n node directs the flow based on the determined status. If the status is "new", the Create new file GitHub n8n node executes. If the status is "different", the Edit existing file GitHub n8n node updates the content. If the status is "same", the n8n workflow completes the item without action.To deploy this powerful n8n workflow, follow these steps:
Get file data, Create new file, and Edit existing file n8n nodes. Ensure the credential token has repository read/write access.n8n node so it can list workflows on the instance.Globals n8n node and update the parameters under the Assignments tab:repo.owner: Your GitHub username/organization name.repo.name: The name of the repository you wish to use for backups.repo.path: The desired subdirectory path (e.g., workflows/). If you wish to use the dynamic tagging feature, keep the existing expression. Manual Trigger n8n node or rely on the configured Schedule Trigger n8n trigger for daily automation.This n8n workflow utilizes several key nodes to achieve its goal:
Schedule Trigger / Manual Trigger (n8n trigger): Initiates the backup process, providing flexibility for scheduled or ad-hoc runs.
n8n (n8n node): Fetches the list of all workflows from the n8n instance, providing the input data for the main loop.
Execute Workflow (n8n node): Essential for the recursive sub-workflow pattern, enabling efficient iteration over all workflows without overloading memory.
Globals (Set n8n node): Holds critical configuration variables (GitHub repository details) that must be edited before the n8n workflow is activated.
Get file data (GitHub n8n node): Attempts to retrieve the existing workflow backup file from GitHub, crucial for the comparison step. Configured to continue on fail.
If file too large (If n8n node) & Get File (HTTP Request n8n node): Handles cases where GitHub returns a download URL instead of content, ensuring large workflow files are successfully retrieved.
isDiffOrNew (Code n8n node): Contains the core custom scripting logic. This n8n node decodes base64 content, orders JSON keys, and compares the stringified objects to determine if a meaningful change has occurred, setting the githubstatus property.
Check Status (Switch n8n node): Directs the flow based on the githubstatus calculated by the Code n8n node (new, different, or same).
Use this powerful n8n workflow to automatically backup all your decrypted n8n credentials to GitHub. Protect your data using this reliable n8n templates solution.

Automate robust version control for your n8n instances. This n8n workflow uses an n8n trigger to fetch all active n8n templates and back them up securely to GitHub, ensuring data integrity and easy rollback.

Use this robust n8n workflow to automatically backup and version your production n8n workflows to a secondary n8n instance using the n8n API. Includes rolling retention and Notion tracking.

Use this robust n8n workflow to automatically backup all your n8n workflows to a specified GitHub repository. Ensure data safety and version control for your n8n automation projects.

Build an intelligent, multi-tool HR Chatbot using n8n and Langchain. Index BambooHR policies into Supabase and enable employee lookup with a robust n8n workflow.








































