feat: 支持按项目配置钉钉通知 @ 名单
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a4cd855b0c
commit
10c39b5116
@@ -27,7 +27,7 @@ def _signed_webhook_url(webhook_url: str, secret: str) -> str:
|
||||
return f"{webhook_url}{separator}timestamp={timestamp}&sign={quote(base64.b64encode(signature))}"
|
||||
|
||||
|
||||
def _normalize_mobiles(at_mobiles) -> list:
|
||||
def normalize_mobiles(at_mobiles) -> list:
|
||||
"""把手机号配置统一成去重、去空的字符串列表,兼容列表或逗号/换行分隔的字符串。"""
|
||||
if not at_mobiles:
|
||||
return []
|
||||
@@ -43,6 +43,20 @@ def _normalize_mobiles(at_mobiles) -> list:
|
||||
return seen
|
||||
|
||||
|
||||
# Ad_Hoc / App_Store 两份 @ 名单在配置中的键名
|
||||
AT_MOBILES_KEYS = ("at_mobiles", "at_mobiles_app_store")
|
||||
|
||||
|
||||
def merge_project_at_mobiles(dingtalk_config: dict, project_at: dict) -> dict:
|
||||
"""项目配置了 @ 名单时覆盖全局名单(按打包类型分别覆盖),为空则沿用全局名单。"""
|
||||
merged = dict(dingtalk_config or {})
|
||||
for key in AT_MOBILES_KEYS:
|
||||
mobiles = normalize_mobiles((project_at or {}).get(key))
|
||||
if mobiles:
|
||||
merged[key] = mobiles
|
||||
return merged
|
||||
|
||||
|
||||
def build_dingtalk_payload(
|
||||
config_data: dict,
|
||||
download_url: str,
|
||||
@@ -50,7 +64,7 @@ def build_dingtalk_payload(
|
||||
at_mobiles=None,
|
||||
) -> dict:
|
||||
"""生成与 AutoPacking/upload_iap.py 一致的钉钉 Markdown 内容。"""
|
||||
mobiles = _normalize_mobiles(at_mobiles)
|
||||
mobiles = normalize_mobiles(at_mobiles)
|
||||
# App_Store 包与 Ad Hoc 用不同标题,App_Store 只有 IPA 下载地址、无二维码。
|
||||
# 标题必须保留「打包」二字:钉钉机器人启用了自定义关键词,缺少关键词会被拒收。
|
||||
heading = "【iOS】App_Store 打包信息" if config_data.get("BUILD_TYPE") == "App_Store" else "【iOS】打包信息"
|
||||
|
||||
Reference in New Issue
Block a user