Back up n8n workflows to GitHub with change detection and email alerts
Ready for 3.0What this workflow does
This workflow has 18 nodes and runs when another workflow fails (error workflow) (plus 2 other triggers). Along the way it connects GitHub.
How it runs
Trigger: When another workflow fails (error workflow) (plus 2 other triggers).
- Set Alert Details (Edit Fields (Set)): sets 4 fields: subject, message, alertFrom…
- Set Configuration Fields (Edit Fields (Set)): sets 3 fields: githubOwner, githubRepo, backupFolder
- Send Alert Email (Send Email): sends an email over SMTP
- Fetch All Workflows (n8n): uses n8n
- Check Workflows Retrieved (If): checks a condition and branches into true / false
- Prepare Workflow Files (Code): runs custom JavaScript code
- Stop If No Workflows (Stop and Error): stops the run with an error
- Fetch File from GitHub (GitHub): get (file)
- Compare File Contents (Code): runs custom JavaScript code
- Check File Exists (If): checks a condition and branches into true / false
…plus 4 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (11)
- Manual Trigger
n8n-nodes-base.manualTrigger - n8n
n8n-nodes-base.n8n - Code
n8n-nodes-base.code - GitHub
n8n-nodes-base.github - If
n8n-nodes-base.if - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Stop and Error
n8n-nodes-base.stopAndError - Edit Fields (Set)
n8n-nodes-base.set - Send Email
n8n-nodes-base.emailSend - Error Trigger
n8n-nodes-base.errorTrigger - No Operation, do nothing
n8n-nodes-base.noOp
From the author
Quick overview This workflow runs manually or daily on a schedule to export all workflows from an n8n instance and back them up as JSON files in a GitHub repository, only committing files when changes are detected and sending an email alert if a scheduled run…