mirror of
https://github.com/AllSpiceIO/post-dr-comment.git
synced 2025-04-01 12:46:55 +00:00
Add identifier to posted comment
This commit is contained in:
parent
1068b9180f
commit
6546147359
@ -79,6 +79,7 @@ def upsert_comment(design_review: DesignReview, comment_body: str) -> Comment:
|
|||||||
|
|
||||||
existing_comment = None
|
existing_comment = None
|
||||||
comments = design_review.get_comments()
|
comments = design_review.get_comments()
|
||||||
|
updated_comment_body = f"{COMMENT_IDENTIFIER}\n{comment_body}"
|
||||||
|
|
||||||
for comment in comments:
|
for comment in comments:
|
||||||
if COMMENT_IDENTIFIER in comment.body:
|
if COMMENT_IDENTIFIER in comment.body:
|
||||||
@ -87,13 +88,13 @@ def upsert_comment(design_review: DesignReview, comment_body: str) -> Comment:
|
|||||||
|
|
||||||
if existing_comment:
|
if existing_comment:
|
||||||
logger.info("Updating existing comment.")
|
logger.info("Updating existing comment.")
|
||||||
existing_comment.body = comment_body
|
existing_comment.body = updated_comment_body
|
||||||
existing_comment.commit()
|
existing_comment.commit()
|
||||||
|
|
||||||
return existing_comment
|
return existing_comment
|
||||||
else:
|
else:
|
||||||
logger.info("Creating new comment.")
|
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]):
|
def upsert_attachments(comment: Comment, attachments: list[str]):
|
||||||
|
Loading…
Reference in New Issue
Block a user