From bfccfa32e3af48aab4f9e84bd4c4fbd164754d35 Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Fri, 2 Feb 2024 14:49:06 +0800 Subject: [PATCH] hotfix for save pull request body --- server/tasks/github/issue.py | 2 +- server/tasks/github/pull_request.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/tasks/github/issue.py b/server/tasks/github/issue.py index c722eaca..242a4db3 100644 --- a/server/tasks/github/issue.py +++ b/server/tasks/github/issue.py @@ -186,7 +186,7 @@ def on_issue_updated(event_dict: dict) -> list: if issue: issue.title = issue_info.title - issue.description = issue_info.body + issue.description = issue_info.body[:1000] if issue_info.body else None issue.extra = issue_info.model_dump() db.session.commit() diff --git a/server/tasks/github/pull_request.py b/server/tasks/github/pull_request.py index 663e7e0b..8b310ea4 100644 --- a/server/tasks/github/pull_request.py +++ b/server/tasks/github/pull_request.py @@ -66,7 +66,7 @@ def on_pull_request_opened(event_dict: dict | list | None) -> list: repo_id=repo.id, pull_request_number=pr_info.number, title=pr_info.title, - description=pr_info.body[:1000], + description=pr_info.body[:1000] if pr_info.body else "", base=pr_info.base.ref, head=pr_info.head.ref, state=pr_info.state, @@ -105,7 +105,9 @@ def on_pull_request_updated(event_dict: dict) -> list: ) if pr: pr.title = event.pull_request.title - pr.description = event.pull_request.body + pr.description = ( + event.pull_request.body[:1000] if event.pull_request.body else "" + ) pr.base = event.pull_request.base.ref pr.head = event.pull_request.head.ref pr.state = event.pull_request.state