From 579a8909070e673783794e55fc3c1b4f22c6f266 Mon Sep 17 00:00:00 2001 From: Marc Khoury Date: Fri, 8 Mar 2024 22:34:33 -0500 Subject: [PATCH] Refactor review comment formatting in entrypoint.py --- entrypoint.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/entrypoint.py b/entrypoint.py index 113e7b1..fc10c7b 100755 --- a/entrypoint.py +++ b/entrypoint.py @@ -124,12 +124,13 @@ def format_review_comment(summarized_review: str, chunked_reviews: List[str]) -> return summarized_review unioned_reviews = "\n".join(chunked_reviews) review = f""" -# Summary -{summarized_review} +

Summary

---- -#Chunks -{unioned_reviews} +{summarized_review.replace('\n', '
')} + +
+

Chunks

+{unioned_reviews.replace('\n', '
')} """ return review @@ -176,16 +177,14 @@ def main( chunked_reviews=chunked_reviews) - # write "test" to environment variable GITHUB_STEP_SUMMARY - os.environ["GITHUB_STEP_SUMMARY"] = "review_comment" # Create a comment to a pull request - # create_a_comment_to_pull_request( - # github_token=os.getenv("GITHUB_TOKEN"), - # github_repository=os.getenv("GITHUB_REPOSITORY"), - # pull_request_number=int(os.getenv("GITHUB_PULL_REQUEST_NUMBER")), - # git_commit_hash=os.getenv("GIT_COMMIT_HASH"), - # body=review_comment - # ) + create_a_comment_to_pull_request( + github_token=os.getenv("GITHUB_TOKEN"), + github_repository=os.getenv("GITHUB_REPOSITORY"), + pull_request_number=int(os.getenv("GITHUB_PULL_REQUEST_NUMBER")), + git_commit_hash=os.getenv("GIT_COMMIT_HASH"), + body=review_comment + ) if __name__ == "__main__":