Use this powerful n8n workflow to automatically synchronize and deploy changes to your n8n templates every time a Pull Request is merged on GitHub, enabling a true GitOps approach.
Download this n8n workflow template and start using it instantly.
Managing changes to complex automation flows can be challenging without proper version control. This specific n8n workflow solves the problem of manual deployment by implementing a GitOps strategy. Every time a development team merges a Pull Request containing changes to stored n8n workflow JSON files, this n8n automation template ensures those changes are instantly reflected in the running n8n instance. This eliminates human error, provides an audit trail via Git, and guarantees that your live n8n environment always matches the approved code in your repository. This process utilizes the internal n8n API, making the synchronization seamless and highly efficient for updating or creating new n8n workflow items.
The entire process is initiated by a single n8n trigger event from GitHub.
Github Trigger - When there is new pull request node, listening for any pull request event on the configured repository.Check if trigger event is pull request merged, acts as a gatekeeper. It strictly checks if the incoming payload action is 'closed' AND if the PR was successfully merged. If these conditions are met, the automation proceeds.mergecommitsha provided by the trigger payload, the workflow fetches the detailed commit information via a GitHub API request. This detail includes a list of all files that were modified, added, or deleted.Get files changes details node uses the Split Out function to create one n8n item for every file changed in the merge commit.base64Decode() function to convert the content back into a usable JSON object.To deploy this powerful n8n workflow, follow these steps:
GitHub Trigger node and the subsequent GitHub API credentials. It is highly recommended to use a Personal Access Token (PAT) classic with repo and admin:repohook scopes enabled, as detailed in the sticky note within the n8n workflow.Update workflow in n8n and Create new workflow in n8n n8n node actions. This allows the workflow to manage the workflows on the host instance.githubowner and reponame).pullrequest events, pointing to the webhook URL exposed by the initial Github Trigger n8n node. Then, activate the n8n workflow. Github Trigger - When there is new pull request (n8n trigger): The entry point of the n8n workflow. It uses a webhook to listen for pull request events on a specified repository.
Define Local Variables (Set n8n node): Stores essential configuration details like githubowner and reponame for reuse throughout the n8n automation.
Check if trigger event is pull request merged (Filter n8n node): Crucial flow control step that ensures subsequent actions only occur if the PR action is 'closed' and the PR was actually 'merged'.
Fetch merged commit details via GitHub API (HTTP Request n8n node): Uses the dynamic mergecommitsha from the trigger data to retrieve the full commit details, specifically identifying all modified files.
Get files changes details (Split Out n8n node): Splits the JSON array of changed files into individual items, allowing the n8n workflow to process each file independently.
Filter modified/created workflows (Filter n8n node): Separates items based on file status ('modified' or 'added') to determine whether an 'update' or 'create' operation is needed on the running n8n instance.
Fetch workflow content from Git (GitHub n8n node): Connects back to GitHub to retrieve the base64-encoded file content for the specific n8n workflow file path.
Decode workflow content to json (Set n8n node): Decodes the base64 content into valid JSON structure required for the next n8n node operation.
Automate instant lead synchronization using this robust n8n workflow. Capture data from Facebook Lead Ads, log it in Google Sheets, and create corresponding Lead records in Salesforce CRM immediately.

Use this powerful n8n workflow to sync Excel events from Google Drive to Google Calendar. Features AI analysis, smart tagging, and automated executive email summaries, enhancing scheduling accuracy with every run.

Automate Eventbrite order and refund data sync directly to KlickTipp using this robust n8n workflow. Ensure precise contact segmentation for targeted event marketing campaigns.

Archive Gmail emails to PostgreSQL and backup attachments to S3/MinIO automatically. Use this reliable n8n workflow template for data compliance and searchability.

Automate daily task creation by syncing Google Calendar events to Trello cards using this powerful n8n workflow. Filter recurring meetings and ensure essential tasks are captured.








































