Skip to content

Commit

Permalink
Refactor review comment formatting in entrypoint.py
Browse files Browse the repository at this point in the history
  • Loading branch information
koganei committed Mar 9, 2024
1 parent a6ef05c commit 579a890
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
<h2>Summary</h2>
---
#Chunks
{unioned_reviews}
{summarized_review.replace('\n', '<br>')}
<hr>
<h2>Chunks</h2>
{unioned_reviews.replace('\n', '<br>')}
"""
return review

Expand Down Expand Up @@ -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__":
Expand Down

0 comments on commit 579a890

Please sign in to comment.