Overview
This node backs up n8n workflows to a specified GitHub repository. It supports backing up all workflows, only active workflows, or workflows filtered by specific tags. The node saves each workflow as an individual JSON file and can optionally create a daily full backup file containing all selected workflows.
Typical use cases include:
- Automating version control of your n8n workflows by storing them in GitHub.
- Creating regular backups to prevent data loss.
- Filtering backups to only important or production workflows using tags.
For example, you might schedule this node to run daily, backing up all active workflows to a GitHub repo branch named "main" with a timestamped commit message.
Properties
| Name | Meaning |
|---|---|
| Backup Mode | Choose which workflows to backup: - All Workflows - Active Only - Filter by Tags |
| Tags | Comma-separated list of tags to filter workflows by (only shown if "Filter by Tags" is selected) |
| GitHub Repository | Target GitHub repository in the format owner/repository-name where backups will be saved |
| Branch Name | Git branch to which the backup files will be committed (default: main) |
| Commit Message | Commit message for the backup commit; supports expressions like current date/time |
| Create Daily Backup | Whether to create a dated full backup file containing all selected workflows (boolean) |
Output
The node outputs a single JSON object per execution containing:
success: Boolean indicating if the backup succeeded.message: Summary message about the backup result.workflowCount: Number of workflows backed up.repository: The GitHub repository used for backup.branch: The Git branch used.files: Array of file paths that were created in the repository during the backup.
If no workflows match the criteria, it returns success with a message stating no workflows found and count zero.
No binary data output is produced by this node.
Dependencies
- Requires access to a GitHub repository with write permissions via an API key credential.
- Requires access to the n8n instance's API to fetch workflows and metadata.
- Needs proper configuration of credentials for GitHub API and n8n API within n8n.
- Uses helper classes internally to interact with GitHub and n8n APIs.
Troubleshooting
Common issues:
- Incorrect GitHub repository format or insufficient permissions may cause failures when saving files.
- Specifying tags that do not match any workflows results in no workflows being backed up.
- Network or authentication errors with either GitHub or n8n API can interrupt the backup process.
Error messages:
"Unsupported backup mode: ..."indicates an invalid selection for backup mode.- Errors related to GitHub API calls usually indicate permission or connectivity problems.
- Warnings about failing to get full workflow data mean partial data was backed up instead.
Resolutions:
- Verify GitHub repository name and ensure the API token has write access.
- Confirm the n8n API credential is valid and the n8n instance is reachable.
- Check tag names carefully if filtering by tags.
- Enable "Continue on Fail" to allow partial backups even if some workflows fail.
Links and References
- GitHub REST API Documentation
- n8n Workflow Management
- n8n Expressions (for commit message templating)