⚙️ Automatic workflow backups to GitLab with GPT-4.1 documentation generation

711 views · ⚙️ DevOps & CI/CD

Description

Auto backup n8n workflows to GitLab with AI-generated documentation

This n8n template automatically backs up your workflows to a GitLab repository whenever they’re updated or activated, and generates README documentation using AI. This workflow can be aslo added as a sub-workflow to any existing workflow to enable backup functionality.

Who’s it for

This template is perfect for n8n users who want to:

How it works

The workflow monitors n8n for workflow updates and activations, then automatically saves the workflow JSON to GitLab and generates a README file using OpenAI:

  1. Trigger Detection: Uses n8n Trigger to detect when workflows are updated or activated
  2. Workflow Retrieval: Fetches the complete workflow data using the n8n API
  3. Repository Check: Lists existing files in GitLab to determine if the workflow already exists
  4. Smart File Management: Either creates a new file or updates an existing one based on the repository state
  5. AI Documentation: Generates a README.md file using OpenAI’s GPT model to document the workflow
  6. GitLab Storage: Saves both the workflow JSON and README to organized folders in your GitLab repository

Requirements

How to set up

  1. Configure GitLab credentials: Add your GitLab API credentials in the GitLab nodes
  2. Set up n8n API: Configure your n8n API credentials for the workflow retrieval node
  3. Add OpenAI credentials: Set up your OpenAI API key in the “Message a model” node
  4. Update repository details: Modify the owner and repository name in GitLab nodes to match your setup
  5. Test the workflow: Save and activate the workflow to test the backup functionality

How to customize the workflow

🔗 Nodes Used

GitLab, n8n Trigger, n8n, Execute Workflow Trigger, OpenAI

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup