8
n8n 中文网amn8n.com

Android功能标志目录与LaunchDarkly对比清理无效标志

中级

这是一个DevOps, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 If, Code, Jira, Slack, Gitlab 等节点。 使用GitLab、LaunchDarkly、Jira和Slack检测未使用的Android功能标志

前置要求
  • Slack Bot Token 或 Webhook URL
  • GitLab Personal Access Token
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "Ozg0c8uxCru2a79p",
  "meta": {
    "instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa"
  },
  "name": "Android (Kotlin/Java) 功能标志目录与 LaunchDarkly 对比清理无效标志(每周)→ Sheets + Jira + PR + Slack",
  "tags": [],
  "nodes": [
    {
      "id": "edcaa1e6-4fd2-4b06-93b5-b9219bbba407",
      "name": "检查无效标志",
      "type": "n8n-nodes-base.if",
      "position": [
        40,
        1680
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json.deadFlag !== undefined}}",
              "operation": "notEqual"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e603fbcb-275a-4356-acbf-d70a219f975c",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -420,
        1360
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtHour": 10
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "70dfcf7f-3d82-44d6-9ea2-ef550b5496f4",
      "name": "GitLab",
      "type": "n8n-nodes-base.gitlab",
      "position": [
        -200,
        1360
      ],
      "parameters": {
        "owner": "",
        "resource": "",
        "operation": "",
        "repository": "",
        "authentication": ""
      },
      "credentials": {
        "gitlabOAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 1
    },
    {
      "id": "13799fe3-a8d0-4dc2-924f-a5c53c17dea5",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -180,
        1680
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "958b3c35-f1ea-4ef4-8c7c-3a69869e4eb1",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        260,
        1760
      ],
      "webhookId": "070511aa-315a-4533-9c71-c820cef4b633",
      "parameters": {
        "otherOptions": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "ecc1b21c-e3b0-40ae-9e21-9b09f69db3cf",
      "name": "Jira Software",
      "type": "n8n-nodes-base.jira",
      "position": [
        260,
        1600
      ],
      "parameters": {
        "project": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "summary": "=Dead feature flag: {{$json.deadFlag}}",
        "issueType": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "566e7571-2423-4e4b-9edf-dea23b9e8fae",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        1360
      ],
      "parameters": {
        "url": "https://app.launchdarkly.com/api/v2/flags/default",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "afb07c42-6687-423b-9ccb-739768aa0c4f",
      "name": "查找无效标志",
      "type": "n8n-nodes-base.code",
      "position": [
        -420,
        1680
      ],
      "parameters": {
        "jsCode": "// 1. Extract LaunchDarkly flags array from input\nconst ldItems = $input.all()[0]?.json?.items || [];\n\n// 2. Extract code flags from another input node named 'Code Flags'\nconst codeFlags = $('Detect flags').all().map(item => item.json.flag);\n\n// 3. Filter dead flags from LD\nconst deadFlags = ldItems.filter(ldFlag => {\n  const isUsedInCode = codeFlags.includes(ldFlag.key);\n\n  if (isUsedInCode) return false;\n\n  const prod = ldFlag.environments?.production || {};\n  const test = ldFlag.environments?.test || {};\n\n  const archivedEverywhere = prod.archived && test.archived;\n  const offInProd = prod.on === false;\n\n  return archivedEverywhere || offInProd;\n});\n\n// 4. Return as array\nreturn deadFlags.map(flag => ({\n  json: {\n    deadFlag: flag.key,\n    reason: flag.environments?.production?.archived\n      ? 'Archived'\n      : 'Off in Production'\n  }\n}));\n"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "75abe5e7-051f-4b87-8329-d10d87ce2b93",
      "name": "检测标志",
      "type": "n8n-nodes-base.code",
      "position": [
        20,
        1360
      ],
      "parameters": {
        "jsCode": "const pattern = /(ENABLE_[A-Z0-9_]+)/g;\nconst flags = new Set();\n\nfor (const item of $input.all()) {\n  const content = item.json.content || ''; // Assumes content was previously fetched\n  let match;\n  while ((match = pattern.exec(content)) !== null) {\n    flags.add(match[1]);\n  }\n}\n\nreturn Array.from(flags).map(flag => ({ json: { flag } }));"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "82ee43c2-85c4-4e36-b0ca-0c848266c6de",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1020,
        1240
      ],
      "parameters": {
        "width": 500,
        "height": 700,
        "content": "**目的:**"
      },
      "typeVersion": 1
    },
    {
      "id": "ce6edc27-0f97-45a9-b36d-ad294963cfac",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        1240
      ],
      "parameters": {
        "color": 4,
        "width": 960,
        "height": 700,
        "content": "## Android (Kotlin/Java) 功能标志目录与 LaunchDarkly 对比清理无效标志(每周)→ Sheets + Jira + PR + Slack"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "97e8bc6b-a717-4a64-a148-620c2991a8fc",
  "connections": {
    "GitLab": {
      "main": [
        [
          {
            "node": "Detect flags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect flags": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Find dead flags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Check Dead Flags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find dead flags": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Dead Flags": {
      "main": [
        [
          {
            "node": "Jira Software",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "GitLab",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 开发运维, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量11
分类2
节点类型9
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
WeblineIndia

WeblineIndia

@weblineindia

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

外部链接
在 n8n.io 查看

分享此工作流