⚙️ Automated workflow backup with intelligent change detection using GitHub

802 views · ⚙️ DevOps & CI/CD

💡 Pro Tip — If you need GitHub data beyond what the REST API gives you, ScraperNode has a repository scraper that extracts metadata at scale without token rate limits.

View All Scrapers

Description

Advanced n8n Workflow Sync with GitHub

A robust workflow to back up and synchronize your n8n workflows to a GitHub repository, with intelligent change detection and support for file renames.

🎯 Who’s it for?

This workflow is for n8n administrators, developers, and power users who want a reliable, automated way to:

✨ Key Features (What it does)

⚙️ How It Works (Simple Steps)

  1. Get n8n Workflows: The workflow starts by fetching all your current workflows from n8n.
  2. Get GitHub Files: At the same time, it lists all existing workflow files from your GitHub repository.
  3. Compare & Decide: It then compares each n8n workflow with its GitHub counterpart. It checks if anything changed, if it was renamed, or if it’s new.
  4. Take Action:
    • If a workflow is new, it’s created on GitHub.
    • If a workflow is updated, the file content is changed on GitHub.
    • If a workflow was renamed, the old file is deleted, and a new one is created.
    • If nothing changed, the workflow is skipped.
  5. Send Report: Finally, it can send a summary report to Telegram about what happened.

🚀 How to Set Up

  1. Credentials:

    • GitHub: Go to Credentials > New and add your GitHub credentials. You’ll need a token with repo permissions.
    • n8n API: In the same Credentials section, create n8n API credentials. You’ll need your n8n instance’s Base URL and an API key (you can create one in your n8n user settings).
    • Telegram (Optional): If you want notifications, add your Telegram Bot credentials.
  2. Configure the Workflow:

    • Open the Configuration node (the green one at the start).
    • Fill in the following values:
      • repo.owner: Your GitHub username or organization name.
      • repo.name: The name of the repository for backups.
      • repo.path: The folder inside the repository to store workflows (e.g., workflows/).
      • report.tg.chatID (Optional): Your Telegram chat ID for notifications. Set to 0 to disable.
      • report.verbose: Set to true to receive a report even if there were no changes.
  3. Connect Credentials:

    • Select your newly created credentials in the following nodes:
      • Get all workflows: Select your n8n API credentials.
      • All GitHub nodes (e.g., List files, Create new file): Select your GitHub credentials.
      • Send a message (Telegram): Select your Telegram credentials.
  4. Set the Schedule:

    • In the Schedule Trigger node, configure how often you want the backup to run (e.g., every hour, once a day).
  5. Activate the Workflow:

    • Save the workflow and toggle it to “Active”.

🔧 How to Customize

💡 What’s Next? (Future Updates)

This workflow is actively maintained! Here’s a sneak peek at what’s planned for future versions:

To get the latest version with these features when it’s released, be sure to follow my profile for new workflow publications!

🔗 Nodes Used

GitHub, Telegram, Stop and Error, n8n, Schedule Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup