Scheduled AI Documentation and GitHub Backup for Active Workflows - n8n Workflow

Automate infrastructure governance using this essential n8n workflow. Periodically back up active n8n templates to GitHub and generate documentation summaries in Notion using the OpenAI n8n node.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

n8n Administrators and Operations Teams requiring infrastructure governance.
Users who need reliable backups of their production n8n templates.
Teams utilizing Notion or GitHub for central documentation of their automation processes.
DevOps specialists looking to automatically document complex n8n workflow configurations.

Overview

Maintaining accurate documentation and backups for production n8n workflows is essential for operational stability. This specialized internal infrastructure n8n workflow solves the problem of manual documentation and governance by automating the entire process on a weekly schedule.

Every Monday, the scheduled n8n trigger runs, identifying all active n8n templates tagged for infrastructure monitoring. It checks if the n8n workflow has been recently updated and, if so, it extracts the full workflow definition. The flow then uses a powerful OpenAI n8n node to automatically generate a concise summary of the workflow's function. Finally, this automation ensures the n8n workflow is backed up to a GitHub repository and that its documentation (including the AI summary) is synchronized or created within a designated Notion database, providing robust governance over your critical n8n infrastructure.

How it Works

This automation runs weekly, driven by a reliable n8n trigger:


  1. Scheduled Execution: The process begins every Monday at 1 AM via the Schedule n8n trigger.

  2. Workflow Retrieval: The workflow uses the dedicated internal n8n node to list all currently active n8n templates that are tagged with internal-infra.

  3. Recent Activity Check: An If n8n node filters the results, continuing only if the n8n workflow was updated in the last 7 days.

  4. Data Preparation: The Set fields n8n node extracts essential metadata (name, ID, active status, creation/update timestamps) and packages the entire raw workflow JSON definition for subsequent steps.

  5. Notion Check: An HTTP Request n8n node queries the Notion database to determine if a page corresponding to this specific n8n workflow already exists.

  6. AI Documentation: The workflow passes the raw JSON definition of the n8n template to the OpenAI n8n node (specifically gpt-4o-mini) to generate a concise functional summary for documentation purposes.

  7. Notion Synchronization: An If n8n node checks if the Notion page exists. If it is a new n8n workflow, it uses the Notion n8n node to Add to Notion. If it exists, it uses the Notion n8n node to Update in Notion with the latest metadata and AI summary.

  8. GitHub Backup & Error Check: Concurrently, the flow checks if the target n8n workflow has its error handling configured. If configuration is confirmed, it attempts to back up the raw n8n workflow JSON to GitHub (trying to edit an existing file first, and falling back to creating a new file if the edit fails). Notifications are sent via Slack for successful updates or failures in backup.

Installation Guide

To deploy this infrastructure n8n workflow, follow these steps:


  1. Import: Import the provided JSON into your n8n instance.

  2. Credentials: Set up credentials for the following services:

Notion API: Configure the credential and grant it access to your target database.
OpenAI: Configure your OpenAI or LangChain credential.
GitHub: Configure an OAuth2 or Personal Access Token credential with repository access.
Slack: Configure a Slack credential for notifications.

  1. Configuration: Update the placeholder values in the following nodes:

Set fields: Update the hostname> placeholder in the url expression to match your n8n instance URL.
Get notion page with workflow id: Replace dbidhere> in the URL.
Add to Notion: Replace the me> database ID.
Upload changes to repo / Create new file in repo: Update the owner and repository name placeholders.

  1. Tagging: Ensure the n8n templates you wish to monitor are tagged with internal-infra.

  2. Activation: Activate the n8n workflow. It will run automatically on the specified weekly schedule.

Node Details

This infrastructure n8n workflow utilizes several key nodes:

Every Monday at 1am (Schedule Trigger n8n trigger): Defines the weekly execution schedule for auditing active n8n templates.
Get active workflows with internal-infra tag (n8n node): Essential for self-governance. It communicates with the internal n8n API to retrieve metadata on all active workflows tagged for internal infrastructure.
Set fields (Set n8n node): Prepares data, generating a unique envId and capturing the full workflow definition JSON as a string, ready for backup and documentation.
Get notion page with workflow id (HTTP Request n8n node): Checks the Notion database for existing documentation, preventing duplicates.
Summarize what the Workflow does (OpenAI n8n node): A powerful AI automation step using GPT-4o-mini to read the complex n8n workflow JSON and generate a human-readable summary, automating the documentation burden.
Is this a new workflow (to Notion) ? (If n8n node): Handles the conditional logic for creating new Notion pages or updating existing ones.
Add/Update in Notion (Notion n8n node): Manages the persistent documentation, pushing metadata and the AI-generated summary to the database.
Upload changes to repo / Create new file in repo (GitHub n8n node): Manages the infrastructure backup by pushing the raw n8n workflow JSON definition to a Git repository, ensuring version control and disaster recovery capabilities.


  • Check that error workflow has been configured (If n8n node): A critical governance check; the backup only proceeds if the monitored n8n workflow has an associated error handler configured.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by
Luke
Luke

Featured*