Sync GitHub Workflows to n8n After Pull Request Merges

Węzły

ba9c0ab0-7276-46e6-9cc4-ac6e16e055473b9f1b78-6b80-4575-aa6c-966987000389083a55c9-df56-4154-959f-52737890cad0696173da-41ce-4099-af01-be2e2f7d5be1e6ae7503-2949-4cf6-8d11-9f146c34f723

Kategorie

Stworzone przez

BaBao Duy Nguyen

Ostatnio edytowane 9 dni temu

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.

Nowy w Świecie n8n?

Potrzebujesz pomocy przy budowie nowych schematów n8n? Automatyzajce procesów dla Ciebie lub Twojej firmy pozwolą oszczędzić ci czas i pieniądze, a do tego bez żadnych kosztów!