Library / Code, Git & Developer Tools
Code, Git & Developer Tools
Restore n8n Workflows from Merged GitHub Pull Requests
When a pull request is merged in GitHub, it fetches the commit details and restores the changed workflows into n8n through the API.
What it 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.
The steps
- Define Local Variables
- Github Trigger - When there is new pull request
- Check if trigger event is pull request merged
- Fetch merged commit details via GitHub API
- Get files changes details
- Filter modified workflows
- Filter created workflows
- Fetch workflow content from Git
- Fetch workflow content from Git1
- Decode workflow content to json
- Decode workflow content to json1
- Update workflow in n8n
- Create new workflow in n8n
Similar automations
Code, Git & Developer ToolsRestore n8n Workflows from GitHub13 stepsCode, Git & Developer ToolsRestore n8n Workflows from GitHub, Skipping Existing Ones12 stepsCode, Git & Developer ToolsBack Up n8n Workflows to GitHub via Pull Requests22 stepsCode, Git & Developer ToolsRestore n8n Workflows from GitHub Backups7 steps