⚙️ Sync GitHub workflows to n8n after pull request merges

1,770 views · ⚙️ DevOps & CI/CD

💡 Pro Tip — If you need GitHub data beyond what the REST API gives you, ScraperNode has a repository scraper that extracts metadata at scale without token rate limits.

View All Scrapers

Description

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

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

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

🔗 Nodes Used

GitHub, Github Trigger, HTTP Request, n8n, Filter

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup