6
mirror of https://github.com/AllSpiceIO/post-dr-comment.git synced 2025-03-28 20:16:53 +00:00

Add identifier to posted comment

This commit is contained in:
Shrikanth Upadhayaya 2024-09-05 14:09:11 -07:00
parent 1068b9180f
commit 6546147359
No known key found for this signature in database

View File

@ -79,6 +79,7 @@ def upsert_comment(design_review: DesignReview, comment_body: str) -> Comment:
existing_comment = None
comments = design_review.get_comments()
updated_comment_body = f"{COMMENT_IDENTIFIER}\n{comment_body}"
for comment in comments:
if COMMENT_IDENTIFIER in comment.body:
@ -87,13 +88,13 @@ def upsert_comment(design_review: DesignReview, comment_body: str) -> Comment:
if existing_comment:
logger.info("Updating existing comment.")
existing_comment.body = comment_body
existing_comment.body = updated_comment_body
existing_comment.commit()
return existing_comment
else:
logger.info("Creating new comment.")
return design_review.create_comment(comment_body)
return design_review.create_comment(updated_comment_body)
def upsert_attachments(comment: Comment, attachments: list[str]):