Skip to main content

Sync GitHub workflows to n8n after pull request merges

Workflow preview

Workflow preview
100%
Sync GitHub workflows to n8n after pull request merges preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Who is this for? This template is ideal for developers, DevOps engineers, and automation managers who manage their n8n workflows using GitHub. It helps teams streamline their CI/CD automation by sy...

Best for

  • DevOps automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.set, n8n-nodes-base.githubtrigger, n8n-nodes-base.filter, n8n-nodes-base.httprequest, n8n-nodes-base.splitout, n8n-nodes-base.github, n8n-nodes-base.n8n, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Bao Duy Nguyen.

Original n8n.io source

1.1 Workflow description

Title
Sync GitHub workflows to n8n after pull request merges
Workflow name
Sync GitHub workflows to n8n after pull request merges

Who is this for?

This template is ideal for developers, DevOps engineers, and automation managers who manage their n8n workflows using GitHub. It helps teams streamline their CI/CD automation by syncing changes from GitHub directly into n8n after a pull request (PR) is merged.

What problem is this workflow solving?

Manually restoring workflows after reviewing and merging code in GitHub can be tedious and error-prone. This workflow solves that by automating the restore process, ensuring that any new or updated workflow committed to your GitHub repo is automatically imported into your n8n environment.

What this workflow does

  • Triggers when a GitHub pull request is closed and merged.
  • Fetches the details of the merge commit.
  • Retrieves the list of added and modified workflow files.
  • Downloads and decodes each workflow file.
  • Creates or updates the corresponding workflow in your n8n instance automatically.

Setup

  1. Connect GitHub: Use the GitHub Trigger node and configure GitHub API credentials. Note: I'd recommended to use GitHub PAT (Personal Access Token) classic with repo and admin:repo_hook permission scopes enabled.
  2. Connect n8n API: Provide your n8n API credentials in the n8n nodes. - Check this doc
  3. Set repository variables: Update github_owner and repo_name in the Define Local Variables node.
  4. Enable webhook: Make sure your GitHub repository has a webhook for pull_request events pointing to this workflow.

How to customize this workflow to your needs

  • Modify filters to handle only certain branches or file paths.
  • Add Slack or email notifications to confirm successful imports.
  • Insert logging or version tagging for better traceability.
  • Extend with conditional logic for workflow testing before applying changes.

This automated flow provides a seamless CI/CD loop between GitHub and n8n, empowering teams to manage workflow versioning efficiently and securely.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Define Local Variables

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 2 - Github Trigger - When there is new pull request

Type / Role
n8n-nodes-base.githubTrigger - githubTrigger
Config choices
Version 1

Block 3 - Check if trigger event is pull request merged

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 4 - Fetch merged commit details via GitHub API

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 5 - Get files changes details

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 6 - Filter modified workflows

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 7 - Filter created workflows

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 8 - Fetch workflow content from Git

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1.1

Block 9 - Fetch workflow content from Git1

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1.1

Block 10 - Decode workflow content to json

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Decode workflow content to json1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Update workflow in n8n

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 13 - Create new workflow in n8n

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 14 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Sync GitHub workflows to n8n after pull request merges
Complexity intermediate
Nodes 14
Categories DevOps
Author Bao Duy Nguyen
Published 30 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4500/4500.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Sync GitHub workflows to n8n after pull request merges do?

Who is this for? This template is ideal for developers, DevOps engineers, and automation managers who manage their n8n workflows using GitHub. It helps teams streamline their CI/CD automation by sy...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.