driazati commented on code in PR #11909:
URL: https://github.com/apache/tvm/pull/11909#discussion_r907550352
##########
tests/scripts/github_docs_comment.py:
##########
@@ -77,9 +104,21 @@ def get_pr_and_build_numbers(target_url):
logging.info(f"Skipping this action for user {author}")
sys.exit(0)
- try:
- github.post(url, {"body": body})
- except error.HTTPError as e:
- logging.exception(f"Failed to add docs comment {docs_url}: {e}")
+ # Get all PR comments
+ pr_comments = get_pr_comments(github, url)
+
+ # Iterate over the PR comments and patch any previous comment.
+ if len(pr_comments) != 0:
Review Comment:
This code should probably search for the comment, then afterwards decide if
it was found or not, something like
```
comment = None
search for comment
if comment is None:
create
else:
update
```
It probably won't happen but it'd enable better logging and there won't
always be a comment from the bot (i.e. if a human commented really quickly on
their PR)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]