Actions2
- Export Actions
- Import Actions
Overview
This node operation imports workflows and/or credentials from a specified GitHub repository into the n8n environment. It is useful for synchronizing or migrating automation workflows and credentials stored in GitHub, enabling version control and collaboration on these assets.
Typical use cases include:
- Importing multiple workflows maintained in a GitHub repo to quickly set up or update an n8n instance.
- Migrating credentials securely stored as JSON files in GitHub into n8n.
- Filtering imported files by name substring to selectively import specific workflows or credentials.
- Managing different branches and paths within a repository to organize imports.
For example, a user can import all workflows from the "workflows" folder on the "main" branch of a GitHub repo owned by "my-org", filtering only those with names containing "sales".
Properties
| Name | Meaning |
|---|---|
| Repository Owner | Owner (user or organization) of the GitHub repository to import from. |
| Repository Name | Name of the GitHub repository to import from. |
| Branch Name | Branch in the repository to import from (e.g., "main", "master"). |
| Import | What to import: one or both of "Workflows" and "Credentials". |
| Workflows Folder Path | Path inside the repository where workflow JSON files are located (default: "workflows"). |
| Credentials Folder Path | Path inside the repository where credential JSON files are located (default: "credentials"). |
| Additional Options | Collection of optional settings: |
| - Filter Files by Name | Only import files whose names contain this string. |
| - File Encoding | Encoding used when downloading files from GitHub; options are "Base64" or "UTF-8" (default: UTF-8). |
| - Overwrite Existing | Whether to overwrite existing workflows/credentials in n8n if they have the same name (boolean). |
Output
The node outputs a JSON object summarizing the import results:
success: Boolean indicating overall success.workflows: Object with:successful: Number of workflows successfully imported.failed: Array of objects describing failed imports with error messages.
credentials: Object with:successful: Number of credentials successfully imported.failed: Array of objects describing failed imports with error messages.
summary: Aggregated totals of successful and failed imports, plus metadata like operation, resource, and timestamp.details: Information about the GitHub repository URL, branch, and paths used.- If workflows were imported successfully, includes
importedWorkflowswith count and import path.
No binary data output is produced by this node.
Dependencies
- Requires valid API credentials for:
- GitHub API: A personal access token with appropriate permissions (repo scope).
- n8n API: An API key credential to interact with the n8n instance's REST API.
- The node uses the GitHub REST API v3 to list directories, fetch file contents, and commit changes.
- The n8n API is used to create or update workflows and credentials based on imported JSON files.
- Network connectivity to GitHub and the n8n instance is required.
Troubleshooting
Common Issues
- Missing or invalid credentials: The node requires both GitHub API credentials and n8n API credentials. Errors will be thrown if these are not provided or invalid.
- Repository or branch not found: If the specified repository or branch does not exist, the node will throw errors instructing to verify the repository and branch names.
- Permission errors: Insufficient GitHub token scopes or n8n API permissions will cause authorization failures.
- File parsing errors: Malformed JSON files in the repository may cause import failures for individual workflows or credentials.
- Conflicts on overwrite: When overwriting existing items, conflicts or API errors may occur if the target item cannot be updated.
Error Messages and Resolutions
"GitHub API credentials are required": Provide valid GitHub API credentials with repo access."n8n API credentials are required": Provide valid n8n API credentials with permission to create/update workflows and credentials."Failed to get directory listing from GitHub": Check repository owner/name, branch name, and network connectivity."Failed to get file from GitHub": Verify file paths and encoding settings."Failed to import workflow to n8n"or"Failed to import credential to n8n": Check that the n8n API key has sufficient rights and that the JSON structure is valid."Repositório ... não existe"(Repository does not exist): Create the repository manually on GitHub before running the import."Branch ... não encontrado"(Branch not found): Create the branch manually or specify an existing branch."Acesso não autorizado ao GitHub"(Unauthorized access): Verify the GitHub token and its scopes.