AI-Driven Configuration Drift Detection and DevOps Auditor - n8n Workflow

Use this powerful n8n workflow to automatically audit GitHub repository configurations against documentation using GPT-4o-mini. Log detailed discrepancies to Google Sheets and send immediate Slack alerts, ensuring DevOps consistency.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

DevOps Engineers responsible for maintaining configuration consistency across environments.
Compliance Officers needing auditable logs of configuration changes and validation.
Technical Writers ensuring documentation remains the source of truth for repository settings.
Teams looking for robust, automated config validation using a proactive n8n solution.

Overview

Maintaining consistency between actively deployed configuration files and centralized reference documentation (like an FAQ or security standard) is a critical challenge in modern DevOps. Configuration drift often leads to unexpected production incidents or security vulnerabilities. This sophisticated n8n workflow solves this by establishing a proactive, AI-powered monitoring system.

The system utilizes a GitHub n8n trigger to instantly start validation upon any code push or pull request event. It fetches the live application configuration and compares it against a defined source of truth (faq-config.json). The core of this n8n template is the LangChain Agent, leveraging GPT-4o-mini, which acts as an expert configuration auditor. It doesn't just check for equality; it uses its intelligence to analyze semantic differences, assign severity (critical, high, medium), and suggest actionable recommendations.

By leveraging this n8n node structure, organizations automate compliance and significantly reduce the manual effort required for config reviews, preventing incidents before they occur. All results, including success cases and detailed issues, are logged into Google Sheets for historical audit, and critical alerts are immediately pushed to Slack.

How it Works

This n8n workflow operates in a sequence of real-time monitoring, parallel data fetching, AI processing, and multi-channel reporting:


  1. Triggering the Validation: The process begins with the GitHub n8n trigger, which activates the entire n8n workflow upon a push or pull_request event in the monitored repository.

  2. Parallel File Retrieval: Two parallel GitHub n8n node operations simultaneously fetch the two crucial files: the config/app-config.json (the actual configuration) and the faq-config.json (the expected reference configuration).

  3. Parsing and Merging: The raw file data is parsed from Base64 into structured JSON using Extract From File n8n node instances. A Merge Config Files n8n node then combines these two inputs into a single data structure, ready for the AI.

  4. AI Configuration Audit: The merged data is sent to the AI Config Comparison Agent n8n node, which uses GPT-4o-mini. The agent follows a strict system prompt to compare the actual config against the expected config, identifying discrepancies, assigning severity, and generating actionable recommendations. The output is forced into a structured JSON schema via the JSON Output Schema n8n node.

  5. Formatting Results: A custom Code n8n node, Format Issues for Logging, processes the AI's complex structured output. This n8n node iterates through potential multiple issues, formats the data into flat columns (e.g., timestamp, configKey, severity, suggestion), and handles success cases where no issues are found.

  6. Logging Audit Trail: The formatted data is appended to a designated Google Sheets document using the Google Sheets n8n node. This creates an immutable history of all config validations.

  7. Alerting Stakeholders: Finally, a Slack n8n node generates a summary alert. This notification includes high-level details, the top discrepancies found, and a link to the full report in Google Sheets, ensuring immediate awareness of high-severity issues identified by the n8n workflow.

Installation Guide

To deploy and utilize this DevOps auditing n8n workflow, follow these steps:


  1. Import the n8n Template: Copy the provided JSON code and import it directly into your n8n instance via the 'Workflows' menu.

  2. GitHub Credentials: Set up your GitHub OAuth2 credentials and link them to the GitHub Push or PR Event n8n trigger and the GitHub fetch nodes. Ensure the credential has webhook and repository read permissions.

  3. OpenAI Setup: Add your OpenAI API key to the relevant credential store. This n8n node requires access to GPT-4o-mini.

  4. Google Sheets Setup: Create a new Google Sheet with the required columns (timestamp, configKey, severity, actualConfig, etc., as detailed in the 'Sheets Configuration' sticky note) and link your Google Sheets OAuth2 credential.

  5. Slack Setup: Link your Slack API credential and configure the target channel ID in the Send Slack Alert n8n node.

  6. Configuration Variables: Adjust the file paths (config/app-config.json and faq-config.json) if your repository uses different locations. Update the placeholder variables in the Workflow Overview sticky note (or create actual n8n environment variables) for the Google Sheet ID and Slack Channel ID.

  7. Activate: Save the n8n workflow and activate the GitHub Push or PR Event n8n trigger. n8n will provide the webhook URL to be configured in your GitHub repository settings.

Node Details

GitHub Push or PR Event (n8n trigger):
Function: Starts the n8n workflow automatically when relevant activity (push or pull request) occurs on the linked repository.
Key Configuration: Configured to monitor both pull_request and push events, ensuring continuous coverage of code changes.
Fetch Repository Config (GitHub n8n node):
Function: Retrieves the content of the live application configuration file (config/app-config.json) from the GitHub repository.
Key Configuration: Uses the file resource with the get operation.
Merge Config Files (Merge n8n node):
Function: Combines the two incoming data streams (the actual config and the FAQ reference) into a single item, which is essential input for the AI n8n node.
Key Configuration: Uses the combine mode.
AI Config Comparison Agent (LangChain Agent n8n node):
Function: The core logic. Compares the two JSON objects based on predefined rules, identifies configuration drift, and assigns severity and recommendations using GPT-4o-mini.
Key Configuration: Uses a highly detailed System Message defining the AI as a DevOps Auditor. It forces structured JSON output for reliability.
Format Issues for Logging (Code n8n node):
Function: Takes the complex structured AI output and flattens it into row-based data suitable for database logging (Google Sheets).
Key Configuration: Contains custom JavaScript logic to handle successful runs (no issues), errors, and map fields like severity and recommendation.
Log to Google Sheets (Google Sheets n8n node):
Function: Persistently logs every configuration audit run, including detailed discrepancies, creating an historical audit trail.
Key Configuration: operation: append. It maps the formatted fields from the preceding n8n node directly to the sheet columns.
Send Slack Alert (Slack n8n node):
Function: Notifies the DevOps team immediately when config issues are detected.
* Key Configuration: Uses a complex expression to display severity emojis and the top 3 issues, linking back to the full Google Sheets report.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

Featured*