From a6ef05c1bcd1c9dd7cea622840f2e8795f195e59 Mon Sep 17 00:00:00 2001 From: Marc Khoury Date: Fri, 8 Mar 2024 22:28:05 -0500 Subject: [PATCH] Refactor review comment formatting --- entrypoint.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/entrypoint.py b/entrypoint.py index 770b774..113e7b1 100755 --- a/entrypoint.py +++ b/entrypoint.py @@ -123,10 +123,13 @@ def format_review_comment(summarized_review: str, chunked_reviews: List[str]) -> if len(chunked_reviews) == 1: return summarized_review unioned_reviews = "\n".join(chunked_reviews) - review = f"""
- {summarized_review} - {unioned_reviews} -
+ review = f""" +# Summary +{summarized_review} + +--- +#Chunks +{unioned_reviews} """ return review @@ -171,14 +174,18 @@ def main( # Format reviews review_comment = format_review_comment(summarized_review=summarized_review, 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__":