ManualTrigger Automate

For n8n, this automated workflow backs up all instance workflows to GitHub every 24 hours, organizing files into a structured `YYYY/MM/` directory path and naming them `ID.json`. It efficiently processes multiple workflows, reducing memory usage by calling itself, and provides real-time notifications via Slack upon completion or failure, ensuring seamless workflow management and data integrity.

7/8/2025
26 nodes
Complex
schedulecomplexsticky noteexecuteworkflowtriggern8nnoopgithubsplitinbatchesschedule triggerslackexecuteworkflowautomationadvancedapiintegrationlogicconditionalroutingcroncommunicationnotification
Categories:
Communication & MessagingSchedule TriggeredComplex WorkflowTechnical Infrastructure & DevOpsBusiness Process Automation
Integrations:
Sticky NoteExecuteWorkflowTriggerN8nNoOpGitHubSplitInBatchesSchedule TriggerSlackExecuteWorkflow

Target Audience

This workflow is designed for:
- Developers: Who need to automate the backup of workflows to GitHub, ensuring version control and easy access.
- Project Managers: Looking to maintain a reliable backup of project workflows to avoid data loss.
- Teams: Collaborating on multiple workflows and requiring a systematic way to track changes and updates in GitHub.
- Automation Enthusiasts: Interested in leveraging n8n for seamless integration with GitHub and Slack for notifications.

Problem Solved

This workflow addresses the issue of workflow backup management by:
- Automating the backup process of n8n workflows to GitHub, ensuring that all changes are recorded and accessible.
- Reducing the risk of data loss by maintaining a versioned history of workflows.
- Providing notifications via Slack to keep team members informed about the backup status, including successes and failures.

Workflow Steps

  • Schedule Trigger: The workflow is triggered on a daily schedule at 1:33 AM.
    2. Starting Message: It sends an initial notification to a Slack channel indicating the start of the backup process.
    3. Loop Over Items: Iterates through all workflows in the n8n instance, processing each one individually.
    4. Get File Data: Attempts to retrieve the existing backup file from GitHub for each workflow.
    5. If File Too Large: Checks if the file size is manageable before proceeding to download.
    6. Merge Items: Combines the data from the retrieved file and the current workflow for comparison.
    7. isDiffOrNew: Determines if the workflow has changed compared to the last backup or if it’s a new workflow.
    8. Check Status: Evaluates the status of the workflow (same, different, or new) and routes accordingly:
    - Same file: Does nothing.
    - File is different: Edits the existing file in GitHub.
    - File is new: Creates a new file in GitHub.
    9. Create/Edit File: Depending on the status, either creates a new file or edits an existing one in GitHub.
    10. Completed Notification: Sends a final notification to Slack indicating the number of workflows processed.
    11. Failed Flows: Notifies the team in Slack if any workflow backup fails during the process.
  • Customization Guide

    To customize this workflow:
    - Change the Schedule: Modify the timing in the Schedule Trigger node to fit your needs.
    - Adjust Slack Notifications: Update the Slack channels and messages to reflect your team's communication style.
    - Modify GitHub Repository Settings: Change the repo owner, name, and path in the Config node to point to your desired GitHub repository.
    - Add New Nodes: Integrate additional nodes for more complex logic or to incorporate other services as needed.
    - Customize File Naming: Adjust the file naming convention in the Create/Edit File nodes to match your organizational standards.