diff --git a/server/tasks/github/issue.py b/server/tasks/github/issue.py index 7b5bd5ba..078b7801 100644 --- a/server/tasks/github/issue.py +++ b/server/tasks/github/issue.py @@ -151,6 +151,9 @@ def on_issue_opened(event_dict: dict | None) -> list: app.logger.info(f"Issue already exists: {issue.id}") return [] + # 限制 body 长度 + issue_info.body = issue_info.body[:1000] if issue_info.body else None + # 创建 issue new_issue = Issue( id=ObjID.new_id(), @@ -158,7 +161,7 @@ def on_issue_opened(event_dict: dict | None) -> list: issue_number=issue_info.number, title=issue_info.title, # TODO 这里超过1024的长度了,暂时不想单纯的增加字段长度,因为飞书那边消息也是有限制的 - description=issue_info.body[:1000] if issue_info.body else None, + description=issue_info.body, extra=issue_info.model_dump(), ) db.session.add(new_issue) diff --git a/server/tasks/github/pull_request.py b/server/tasks/github/pull_request.py index 37c10d0d..a1d37657 100644 --- a/server/tasks/github/pull_request.py +++ b/server/tasks/github/pull_request.py @@ -63,13 +63,16 @@ def on_pull_request_opened(event_dict: dict | list | None) -> list: app.logger.info(f"PullRequest already exists: {pr.id}") return [] + # 限制 body 长度 + pr_info.body = pr_info.body[:1000] if pr_info.body else "" + # 创建 pullrequest new_pr = PullRequest( id=ObjID.new_id(), repo_id=repo.id, pull_request_number=pr_info.number, title=pr_info.title, - description=pr_info.body[:1000] if pr_info.body else "", + description=pr_info.body, base=pr_info.base.ref, head=pr_info.head.ref, state=pr_info.state,