@@ -14,7 +14,7 @@ def __init__(self, webhook_url=None):
1414 self .default_webhook_url = webhook_url or os .environ .get ('FEISHU_WEBHOOK_URL' , '' )
1515 self .enabled = os .environ .get ('FEISHU_ENABLED' , '0' ) == '1'
1616
17- def _get_webhook_url (self , project_name = None , gitlab_url_slug = None ):
17+ def _get_webhook_url (self , project_name = None , url_slug = None ):
1818 """
1919 获取项目对应的 Webhook URL
2020 :param project_name: 项目名称
@@ -30,7 +30,7 @@ def _get_webhook_url(self, project_name=None, gitlab_url_slug=None):
3030
3131 # 构造目标键
3232 target_key_project = f"FEISHU_WEBHOOK_URL_{ project_name .upper ()} "
33- target_key_url_slug = f"FEISHU_WEBHOOK_URL_{ gitlab_url_slug .upper ()} "
33+ target_key_url_slug = f"FEISHU_WEBHOOK_URL_{ url_slug .upper ()} "
3434
3535 # 遍历环境变量
3636 for env_key , env_value in os .environ .items ():
@@ -47,7 +47,7 @@ def _get_webhook_url(self, project_name=None, gitlab_url_slug=None):
4747 # 如果既未找到匹配项,也没有默认值,抛出异常
4848 raise ValueError (f"未找到项目 '{ project_name } ' 对应的 Feishu Webhook URL,且未设置默认的 Webhook URL。" )
4949
50- def send_message (self , content , msg_type = 'text' , title = None , is_at_all = False , project_name = None , gitlab_url_slug = None ):
50+ def send_message (self , content , msg_type = 'text' , title = None , is_at_all = False , project_name = None , url_slug = None ):
5151 """
5252 发送飞书消息
5353 :param content: 消息内容
@@ -61,7 +61,7 @@ def send_message(self, content, msg_type='text', title=None, is_at_all=False, pr
6161 return
6262
6363 try :
64- post_url = self ._get_webhook_url (project_name = project_name , gitlab_url_slug = gitlab_url_slug )
64+ post_url = self ._get_webhook_url (project_name = project_name , url_slug = url_slug )
6565 if msg_type == 'markdown' :
6666 data = {
6767 "msg_type" : "interactive" ,
0 commit comments