Back up and sync workflow JSONs with GitHub using semantic SHAs
Ready for 3.0What this workflow does
This workflow has 40 nodes and runs manually, when you click “Execute workflow”. Along the way it connects GitHub. It also calls api.github.com over HTTP.
How it runs
Trigger: Manually, when you click “Execute workflow”.
- config (Edit Fields (Set)): sets or maps fields
- get_workflows (n8n): uses n8n
- get_not_archived (Filter): keeps only the items that match a condition
- exists_workflows (If): checks a condition and branches into true / false
- get_file_sha (Code): runs custom JavaScript code
- verify_repo (HTTP Request): calls an HTTP API
- Switch: routes items into 5 branches
- github_connectivity_error (Stop and Error): stops the run with an error
- list_files (GitHub): list (file)
- create_repo (HTTP Request): calls api.github.com (POST)
…plus 23 more steps. See the full node list below.
Services it uses
HTTP calls to: api.github.com
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 (13)
- Manual Trigger
n8n-nodes-base.manualTrigger - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request
n8n-nodes-base.httpRequest - n8n
n8n-nodes-base.n8n - Filter
n8n-nodes-base.filter - GitHub
n8n-nodes-base.github - If
n8n-nodes-base.if - No Operation, do nothing
n8n-nodes-base.noOp - Code
n8n-nodes-base.code - Split Out
n8n-nodes-base.splitOut - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Stop and Error
n8n-nodes-base.stopAndError - Switch
n8n-nodes-base.switch
From the author
Quick overview This workflow backs up all non-archived n8n workflows to a GitHub repository as JSON files, using a deterministic semantic SHA in each filename to detect new, updated, renamed, and deleted workflows and keep the repository in sync. How it works…