Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复 Pr Issue desc 太长 #228

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/tasks/github/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,17 @@ 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(),
repo_id=repo.id,
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)
Expand Down
5 changes: 4 additions & 1 deletion server/tasks/github/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading