workflows.fit
Back to n8n workflows
n8n templateFreeBy Muhammad Anas Farooq

Back up and restore n8n workflows with GitHub sync

n8n Workflows GitHub Manager > A comprehensive n8n workflow that provides complete bidirectional sync between your n8n instance and GitHub - automatically backs up all your workflows with intelligent change detecti...

DevelopmentCore NodesSchedule TriggerGithubHttp RequestIf
Loading interactive preview...

Template notes

n8n Workflows GitHub Manager

> A comprehensive n8n workflow that provides complete bidirectional sync between your n8n instance and GitHub - automatically backs up all your workflows with intelligent change detection AND restores them when needed.

This workflow combines two powerful features in one: Backup: Automatically detects new, edited, renamed, and deleted workflows in your n8n instance, then syncs them to GitHub with smart commit messages and an index tracking system. Restore: Easily restore all workflows from your GitHub repository back to n8n - perfect for disaster recovery, new instance setup, or environment cloning.

---

How It Works

πŸ”„ Backup Mode (Automatic)

1. Trigger: Runs automatically every day at 7 PM UTC (or manually when triggered via the Schedule Trigger). 2. Get/Create Index: Attempts to fetch index.json from your GitHub repository. If found β†’ Downloads and parses it. If not found β†’ Creates a new empty index file and waits 3 seconds for GitHub to process. 3. Fetch All Workflows: Retrieves all workflows from your n8n instance via the n8n API. 4. Smart Comparison: The "C,E,D Checker" (Create, Edit, Delete) analyzes differences: CREATE β†’ New workflow not in index. RENAME β†’ Workflow name changed (deletes old file, creates new one). EDIT β†’ Existing workflow (flagged for content comparison). DELETE β†’ Workflow removed from n8n but still in GitHub. INDEX UPDATE β†’ Triggered if any changes detected. 5. Route Actions: Switch node routes each action to the appropriate branch: Create Branch β†’ Creates new workflow files in GitHub. Edit Branch β†’ Performs smart edit detection: Fetches current file from GitHub. Compares GitHub version vs. n8n version (normalized JSON). Only commits if content actually changed (avoids timestamp-only updates). Delete Branch β†’ Removes workflow files from GitHub. Update Index Branch β†’ Updates index.json with latest mappings. 6. Commit Messages: Auto-generated with format: [Workflow Name] (Action) YYYY-MM-DD

⬇️ Restore Mode (Manual)