Skip to content

Commit

Permalink
Merge pull request #162 from ConnectAI-E/feature-lloyd-202401230
Browse files Browse the repository at this point in the history
hotfix: set max commit message length. #146
  • Loading branch information
lloydzhou authored Jan 30, 2024
2 parents f411536 + 7bbd938 commit a100e10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions server/utils/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ class TopicType(Enum):

class GitHubPermissionError(Exception):
pass


MAX_COMMIT_MESSAGE_LENGTH = 40
5 changes: 3 additions & 2 deletions server/utils/lark/pr_tip_commit_history.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from utils.constant import MAX_COMMIT_MESSAGE_LENGTH
from utils.github.model import Commit

from .base import *
Expand All @@ -10,8 +11,8 @@ def __init__(
):
def process_commit_message(message: str) -> str:
title = message.split("\n")[0] if "\n" in message else message
if len(title) > 23:
title = title[:20] + "..."
if len(title) > (MAX_COMMIT_MESSAGE_LENGTH + 3):
title = title[:MAX_COMMIT_MESSAGE_LENGTH] + "..."
return title

content = "\n".join(
Expand Down

0 comments on commit a100e10

Please sign in to comment.