Automated Feature Flag Sweeper for Android Codebases - n8n Workflow

Use this powerful n8n workflow to automatically detect unused Android feature flags (Kotlin/Java) in GitLab by comparing them against LaunchDarkly status. Integrate Jira and Slack for cleanup, reducing technical debt.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • DevOps Engineers focused on system hygiene.

  • Software Development Teams using Kotlin/Java and GitLab.

  • Product Managers who need automated technical debt tracking.

  • Anyone seeking robust n8n templates for flag management using LaunchDarkly.

Overview

Managing feature flags in large codebases can quickly lead to technical debt if unused flags are left active or cluttering the configuration. This sophisticated n8n workflow provides an automated solution for sweeping 'dead' flags.

By leveraging n8n’s ability to connect diverse services—GitLab for code, LaunchDarkly for flag status, Google Sheets for logging, and Jira/Slack for alerting—this automation runs weekly. It drastically reduces manual effort required for feature flag cleanup, ensuring your Android application remains lean and maintainable. This powerful n8n workflow is a prime example of complex, multi-system automation.

How it Works

This n8n workflow executes weekly, driven by the Schedule Trigger n8n node:


  1. Scheduled Start: The automation is initiated every week at 10 AM by the n8n trigger.

  2. Code Analysis (GitLab): The GitLab n8n node fetches the specified codebase content.

  3. Feature Extraction: The custom Detect flags Code n8n node uses a Regular Expression (ENABLE[A-Z0-9]+) to identify all feature flags currently referenced in the Kotlin/Java source files.

  4. LaunchDarkly Data Fetch: An HTTP Request n8n node queries the LaunchDarkly API to retrieve a list of all defined flags and their operational status (archived, production status).

  5. Comparison Logic: The critical Find dead flags Code n8n node compares the two lists. A flag is marked as 'dead' if it is not found in the codebase AND is either archived in all environments or turned off in production. This custom n8n node ensures highly accurate detection.

  6. Logging: All findings, specifically the dead flags, are appended to the designated Google Sheets document for historical tracking and review.

  7. Conditional Alerting: The Check Dead Flags If n8n node checks if the previous step produced any dead flags.

  8. Action & Notification: If dead flags are identified, the n8n workflow splits to:

Create corresponding tickets in Jira Software with a clear summary: 'Dead feature flag: [Flag Name]'.
Send immediate alerts and summaries to the team via Slack about the detected issues. This robust use of n8n templates ensures rapid response to emerging technical debt.

Installation Guide

To install this n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON data and import it into your n8n instance using the 'New' menu -> 'Import from JSON'.

  2. Credentials Setup: You will need to configure credentials for the following services:

GitLab: Requires OAuth2 credentials to access your repository content.
LaunchDarkly: Requires an API key for the HTTP Request n8n node, typically placed in the headers for authentication.
Google Sheets: Requires OAuth2 credentials linked to the account owning the target spreadsheet.
Jira Software: Requires API token or OAuth credentials to create issues.
Slack: Requires a webhook or bot token for posting messages.

  1. Configuration: Update the n8n node parameters:

Configure the Schedule Trigger time if the weekly 10 AM schedule is unsuitable.
Update the GitLab and Google Sheets n8n nodes with the correct repository and document IDs.
Set the correct Project ID and Issue Type in the Jira Software n8n node.

  1. Activation: Ensure the n8n workflow is marked as 'Active' after setup to allow the n8n trigger to fire weekly.

Node Details


  • Schedule Trigger: Acts as the primary n8n trigger, initiating the entire n8n workflow weekly at a set time (10:00).

  • GitLab: This n8n node connects to the repository to fetch the code files necessary for analysis.

  • Detect flags (Code n8n node): Scans the incoming code content using regex (\/(ENABLE[A-Z0-9]+)\/g) to extract a set of currently utilized feature flag names.

  • HTTP Request: Used to securely connect to the LaunchDarkly API (/api/v2/flags/default) to retrieve the current state of all feature flags, their environments, and archival status.

  • Find dead flags (Code n8n node): The core logic custom n8n node. It compares flags found in code versus flags reported by LaunchDarkly. It determines a flag is dead if it's unused in the code and is either archived or deactivated in production.

  • Google Sheets: Logs the results of the Find dead flags n8n node, providing a persistent record of detected unused flags.

  • Check Dead Flags (If n8n node): A critical flow control n8n node that checks if the deadFlag variable exists in the input data. Only if dead flags are found does the n8n workflow proceed down the success branch.

  • Jira Software: Automatically creates detailed tickets for each detected dead flag, routing the cleanup task to the appropriate team.

  • Slack: Sends immediate alerts and notifications to a designated channel regarding the technical debt found by this n8n automation.

Related n8n Workflows

Free

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

A Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.

Featured*