Skip to main content

Bidirectional GitHub workflow sync & version control for n8n workflows

Workflow preview

Workflow preview
100%
Bidirectional GitHub workflow sync & version control for n8n workflows preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Who is this for? This template is ideal for n8n administrators, automation engineers, and DevOps teams who want to maintain bidirectional synchronization between their n8n workflows and GitHub repo...

Best for

  • DevOps automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.n8n, n8n-nodes-base.scheduletrigger, n8n-nodes-base.github, n8n-nodes-base.converttofile, n8n-nodes-base.extractfromfile, n8n-nodes-base.stickynote, n8n-nodes-base.comparedatasets, n8n-nodes-base.code

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Wikus Bergh.

Original n8n.io source

1.1 Workflow description

Title
Bidirectional GitHub workflow sync & version control for n8n workflows
Workflow name
Bidirectional GitHub workflow sync & version control for n8n workflows

Who is this for? This template is ideal for n8n administrators, automation engineers, and DevOps teams who want to maintain bidirectional synchronization between their n8n workflows and GitHub repositories. It helps teams keep their workflow backups up-to-date and ensures consistency between their n8n instance and version control system.

What problem is this workflow solving? Managing workflow versions across n8n and GitHub can become complex when changes happen in both places. This workflow solves that by automatically synchronizing workflows bidirectionally, ensuring that the most recent version is always available in both systems without manual intervention or version conflicts.

What this workflow does:

  • Runs on a weekly schedule (every Monday) to check for synchronization needs.

  • Fetches all workflows from your n8n instance and compares them with GitHub repository files.

  • Identifies workflows that exist only in n8n and uploads them to GitHub as JSON backups.

  • Identifies workflows that exist only in GitHub and creates them in your n8n instance.

  • For workflows that exist in both places, compares timestamps and syncs the most recent version:

    • If n8n version is newer → Updates GitHub with the latest workflow
    • If GitHub version is newer → Updates n8n with the latest workflow
  • Automatically handles file naming, encoding/decoding, and commit messages with timestamps.

Setup:

  1. Connect GitHub: Configure GitHub API credentials in the GitHub nodes. Note: Use a GitHub Personal Access Token (classic) with repo permissions to read and write workflow files.

  2. Connect n8n API: Provide your n8n API credentials in the n8n nodes. Check this doc

  3. Configure GitHub Details in the Set GitHub Details node:

    • github_account_name: Your GitHub username or organization
    • github_repo_name: The repository name where workflows should be stored
    • repo_workflows_path: The folder path in your repo (e.g., workflows or n8n-workflows)
  4. Adjust Schedule: Modify the Schedule Trigger if you want a different sync frequency (currently set to weekly on Mondays).

  5. Test the workflow: Run it manually first to ensure all connections and permissions are working correctly.

How to customize this workflow to your needs:

  • Change sync frequency: Modify the Schedule Trigger to run daily, hourly, or on-demand.
  • Add filtering: Extend the Filter node to exclude certain workflows (e.g., test workflows, templates).
  • Add notifications: Insert Slack, email, or webhook notifications to report sync results.
  • Implement conflict resolution: Add custom logic for handling workflows with the same timestamp.
  • Add workflow validation: Include checks to validate workflow JSON before syncing.
  • Branch management: Modify to sync to different branches or create pull requests instead of direct commits.
  • Backup retention: Add logic to maintain multiple versions or archive old workflows.

Key Features:

  • Bidirectional sync: Handles changes from both n8n and GitHub
  • Timestamp-based conflict resolution: Always keeps the most recent version
  • Automatic file naming: Converts workflow names to valid filenames
  • Base64 encoding/decoding: Properly handles JSON workflow data
  • Comprehensive comparison: Uses dataset comparison to identify differences
  • Automated commits: Includes timestamps in commit messages for traceability

This automated synchronization workflow provides a robust backup and version control solution for n8n workflows, ensuring your automation assets are always safely stored and consistently available across environments.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Create new workflow in n8n

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 2 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 3 - List files from repo

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1

Block 4 - GitHub

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1.1

Block 5 - n8n

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 6 - Upload file

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1

Block 7 - Json file

Type / Role
n8n-nodes-base.convertToFile - convertToFile
Config choices
Version 1.1

Block 8 - To base64

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 9 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Update file

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1

Block 11 - Json file1

Type / Role
n8n-nodes-base.convertToFile - convertToFile
Config choices
Version 1.1

Block 12 - To base

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 13 - n8n vs GitHub

Type / Role
n8n-nodes-base.compareDatasets - compareDatasets
Config choices
Version 2.3

Block 14 - Update workflow in n8n

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 15 - Code - InputB

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - Code - InputA

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 18 - Edit for Upload

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 19 - Edit for Update

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 20 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - If n8n before GitHub

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 23 - Decode to json

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 24 - Filter

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Showing the first 24 of 25 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Bidirectional GitHub workflow sync & version control for n8n workflows
Complexity advanced
Nodes 25
Categories DevOps
Author Wikus Bergh
Published 20 Jun 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5081/5081.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Bidirectional GitHub workflow sync & version control for n8n workflows do?

Who is this for? This template is ideal for n8n administrators, automation engineers, and DevOps teams who want to maintain bidirectional synchronization between their n8n workflows and GitHub repo...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.