# Sync staging n8n workflows to GitHub: n8n workflow template

> Started by an event in a connected app, and works across GitHub. 16 steps, 1 branch: a working afternoon to understand properly.

Source: https://millionrounds.com/workflow/sync-staging-n8n-workflows-to-github (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Data collection](https://millionrounds.com/workflows?category=Data+collection#library)

# Sync staging n8n workflows to GitHub

Started by an event in a connected app, and works across GitHub. 16 steps, 1 branch: a working afternoon to understand properly.

Medium

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsync-staging-n8n-workflows-to-github)

**16 steps** Medium: a working afternoon

**1** Branch: places the flow splits

**0** Loops or waits

**1** Service it connects to

## The flow

Starts it 2 Logic 4 Service 10

The steps in the order they run, from what starts it.

- 1 **When Executed by Another Workflow** Execute Workflow trigger *Starts it*
- 2 **n8n Trigger** N8n trigger *Starts it*
- 3 **Set publish variables** Set *Logic*
- 4 **Get n8n workflow JSON** Http Request *Service*
- 5 **Strip workflow metadata** Code *Logic*
- 6 **Get a repository** Github *Service*
- 7 **Convert JSON to file** Convert To File *Service*
- 8 **Get main branch SHA** Http Request *Service*
- 9 **Create Github Repo** Http Request *Service*
- 10 **Extract JSON from file** Extract From File *Service*
- 11 **Create Github branch** Http Request *Service*
- 12 **Merge file data** Merge *Logic*
- 13 **Check Error Message** If *Logic*
- 14 **Get existing file in repo** Http Request *Service*
- 15 **Add workflow to branch** Http Request *Service*
- 16 **Create Github Pull Request** Http Request *Service*

## How it's built

- **Starts on:** An event in a connected app
- **Steps:** 16, with 1 branch
- **Size:** Medium: a working afternoon
- **Connects to:** GitHub
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account, plus your own GitHub account. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an event in a connected app.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Plan an afternoon. 16 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 16 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsync-staging-n8n-workflows-to-github)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[GitHub](https://millionrounds.com/workflows?service=GitHub#library)

## Workflows like it

Also data collection, with the same services where possible, closest in size first.

- [**Analyze mobile app build-time hotspots with Gradle** 15 steps · calls a model · Airtable, GitHub](https://millionrounds.com/workflow/analyze-mobile-app-build-time-hotspots-with-gradle)
- [**Find and track flaky CI jobs in GitHub Actions with OpenAI** 19 steps · calls a model · GitHub, Slack](https://millionrounds.com/workflow/find-and-track-flaky-ci-jobs-in-github-actions-with-openai)
- [**Validate GitHub configurations with OpenAI and Slack** 13 steps · calls a model · GitHub, Google Sheets](https://millionrounds.com/workflow/validate-github-configurations-with-openai-and-slack)
- [**Sync Azure DevOps work items to GitHub issues** 12 steps · GitHub, Google Sheets](https://millionrounds.com/workflow/sync-azure-devops-work-items-to-github-issues)
- [**Triage GitHub issues to a Notion board with Qwen** 12 steps · calls a model · GitHub, Notion](https://millionrounds.com/workflow/triage-github-issues-to-a-notion-board-with-qwen)
- [**Bidirectional GitHub workflow sync & version control** 22 steps · GitHub](https://millionrounds.com/workflow/bidirectional-github-workflow-sync-and-version-control)
