[OPS] Restore workflows from GitHub to n8n

For n8n, this workflow automates the restoration of workflows from GitHub, ensuring that only non-duplicate workflows are created in your n8n environment. By integrating with GitHub, it simplifies the backup recovery process, allowing users to efficiently manage and restore their automated tasks without the risk of overwriting existing workflows.

7/4/2025
17 nodes
Complex
manualcomplexsticky notenoopgithubn8nadvancedlogicconditional
Categories:
Technical Infrastructure & DevOpsManual TriggeredComplex Workflow
Integrations:
Sticky NoteNoOpGitHubN8n

Target Audience

This workflow is designed for:
- Developers who need to restore workflows from GitHub to n8n.
- Project Managers who want to ensure workflow continuity by restoring backups.
- DevOps Engineers looking to automate the process of managing workflows in n8n.
- Data Analysts who require consistent and reliable workflows for data processing tasks.

Problem Solved

This workflow addresses the issue of restoring workflows that may have been lost or need to be re-imported from GitHub. It automates the process of checking for existing workflows, retrieving them from GitHub, and creating new workflows in n8n only if they do not already exist, thus preventing duplicates.

Workflow Steps

  • Manual Trigger: The workflow starts when the user clicks 'execute'.
    2. Set Globals: It sets global variables for the GitHub repository owner, name, and path.
    3. Get All Files from GitHub: It retrieves a list of all workflow files from the specified GitHub repository.
    4. Get Existing Workflows from n8n: It fetches the current workflows in the n8n environment.
    5. Merge Data: The workflow merges the data from GitHub and n8n to identify which workflows do not already exist in n8n.
    6. Check for Existing Workflows: For each workflow, it checks if a workflow with the same name already exists in n8n.
    7. Create New Workflows: If a workflow does not exist, it creates a new workflow in n8n using the content retrieved from GitHub.
    8. Handle Duplicates: If a workflow already exists, it logs this and does not create a duplicate.
  • Customization Guide

    Users can customize this workflow by:
    - Modifying Global Variables: Change the repo.owner, repo.name, and repo.path in the Globals node to point to your specific GitHub repository.
    - Adjusting Workflow Logic: You can modify the conditions in the 'If workflow already exists' node to change how duplicates are handled.
    - Adding More Nodes: Users can add additional nodes for logging or notifications to alert when workflows are successfully restored or if duplicates are found.
    - Changing File Retrieval Settings: Adjust the parameters in the GitHub nodes to filter or change how files are fetched.