Backup workflows to git repository

Backup workflows to GitHub automatically every minute, ensuring your data is securely stored and easily recoverable. This complex workflow integrates multiple tools to efficiently manage and commit changes, providing peace of mind and streamlined version control.

7/8/2025
17 nodes
Complex
schedulecomplexgithubn8nsplitinbatchesschedule triggersticky noteautomationadvancedlogicconditionalcron
Categories:
Schedule TriggeredComplex WorkflowTechnical Infrastructure & DevOps
Integrations:
GitHubN8nSplitInBatchesSchedule TriggerSticky Note

Target Audience

Target Audience


- Developers: Those who need to back up their workflows to GitHub regularly.
- Project Managers: Individuals overseeing projects who want to ensure that workflows are safely stored and version-controlled.
- Data Engineers: Professionals managing data workflows who require an automated backup solution to prevent data loss.
- Automation Enthusiasts: Users interested in automating their workflow backups for efficiency and reliability.

Problem Solved

Problem Solved


This workflow addresses the challenge of maintaining up-to-date backups of workflows in a GitHub repository. It ensures that:
- Workflows are automatically backed up on a scheduled basis to prevent loss of important configurations.
- Changes made to workflows are tracked and committed, providing version control and history.
- Users can easily check for updates and changes, enhancing collaboration and accountability within teams.

Workflow Steps

Workflow Steps


1. Schedule Trigger: The workflow initiates based on a defined schedule, allowing for automatic execution at specified intervals.
2. Set Globals: Repository details (owner, name, and path) are established, which are essential for subsequent GitHub operations.
3. Fetch Workflows: The workflow retrieves all existing workflows from the n8n instance.
4. Loop Over Items: Each workflow is processed individually, allowing for batch operations.
5. Check File Existence: The workflow checks if a corresponding file already exists in the GitHub repository.
6. Conditional Logic: If the file does not exist, it creates a new file and commits it. If it exists, it checks for differences and updates the file if necessary.
7. Convert Content: Workflow content is converted to a JSON string for easy storage and retrieval.
8. Commit Changes: Updated or new files are committed back to GitHub with a message indicating the backup operation.

Customization Guide

Customization Guide


- Change Schedule: Adjust the scheduling parameters in the Schedule Trigger node to change how often the workflow runs (e.g., hourly, daily).
- Modify Repository Details: Update the Globals node to reflect the correct GitHub repository owner, name, and path for your specific use case.
- Add Additional Nodes: Integrate additional nodes for further processing or notifications (e.g., send an email after a successful backup).
- Adjust File Paths: Change the file path in the Create new file and commit and Update file content and commit nodes to customize where files are stored in the repository.
- Enhance Error Handling: Implement more robust error handling in the conditional checks to manage different types of errors that may occur during execution.
Backup workflows to git repository - N8N Workflow Directory