{"product_id":"back-up-n8n-workflows-to-github-deterministic-json-exports","title":"Back Up n8n Workflows to GitHub: Deterministic JSON Exports","description":"\u003ch3\u003eBack up your n8n workflows to GitHub—deterministic JSON exports with no noisy commits\u003c\/h3\u003e\n\u003cp\u003eThis n8n automation runs daily to export \u003cstrong\u003eall your n8n workflows\u003c\/strong\u003e, converts them into \u003cstrong\u003edeterministic JSON\u003c\/strong\u003e files, and pushes updates to \u003cstrong\u003eGitHub\u003c\/strong\u003e only when the exported content truly changes—so your repository stays clean and trustworthy.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSchedules automatically\u003c\/strong\u003e: runs every day at \u003cstrong\u003e03:05\u003c\/strong\u003e (or any schedule you set).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePulls every workflow\u003c\/strong\u003e from your n8n instance via the \u003cstrong\u003en8n API\u003c\/strong\u003e, including \u003cstrong\u003earchived\u003c\/strong\u003e workflows.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNormalizes exports\u003c\/strong\u003e to deterministic JSON by stripping volatile fields and sorting JSON keys.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOrganizes archived workflows separately\u003c\/strong\u003e and generates a \u003cstrong\u003eREADME inventory\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eBuilds a single Git tree\u003c\/strong\u003e containing every workflow file.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePrevents leftovers\u003c\/strong\u003e: marks orphaned exports for deletion so renamed or deleted workflows don’t remain in the backup.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCommits only when needed\u003c\/strong\u003e: reads the current GitHub branch state (reference, commit, repository tree) and creates a new commit \u003cem\u003eonly\u003c\/em\u003e if the newly built tree differs.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAudit and compliance\u003c\/strong\u003e: maintain a versioned record of workflow changes over time.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDisaster recovery\u003c\/strong\u003e: quickly restore or compare n8n workflow definitions by pulling from GitHub.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSafe refactoring\u003c\/strong\u003e: verify that updates truly modify workflow content—without flooding commits.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSaaS operations\u003c\/strong\u003e: track changes across environments by backing up workflow definitions regularly.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eNodes\/logic used: \u003cstrong\u003eSchedule Trigger\u003c\/strong\u003e, \u003cstrong\u003en8n\u003c\/strong\u003e (workflow\/API retrieval), \u003cstrong\u003eCode\u003c\/strong\u003e (deterministic JSON normalization and comparison), plus \u003cstrong\u003eHTTP Request\u003c\/strong\u003e for GitHub operations.\u003c\/li\u003e\n  \u003cli\u003eGitHub integration: uses the \u003cstrong\u003eGit Data API\u003c\/strong\u003e via \u003cstrong\u003eHTTP Request\u003c\/strong\u003e nodes to read branch\/tree state and create commits.\u003c\/li\u003e\n  \u003cli\u003eCredentials: a fine-grained \u003cstrong\u003eGitHub token\u003c\/strong\u003e (Contents \u003cstrong\u003eread\/write\u003c\/strong\u003e) and an \u003cstrong\u003en8n API key\u003c\/strong\u003e for the \u003cstrong\u003eList workflows\u003c\/strong\u003e step.\u003c\/li\u003e\n  \u003cli\u003eImplementation elements include \u003cstrong\u003eif\u003c\/strong\u003e logic to control commit behavior and optional \u003cstrong\u003esticky note\u003c\/strong\u003e for setup clarity.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45876863598771,"sku":"N8N-18512","price":62.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/llMHq8LxsYBaQammodwh7_IoDSzxGD.png?v=1787303438","url":"https:\/\/buyflowscripts.com\/products\/back-up-n8n-workflows-to-github-deterministic-json-exports","provider":"N8N Commerce","version":"1.0","type":"link"}