You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/06/27 13:18:19 UTC
[GitHub] [tvm] gigiblender opened a new pull request, #11909: Docs bot now edits previous comments
gigiblender opened a new pull request, #11909:
URL: https://github.com/apache/tvm/pull/11909
This PR improves the docs bot to edit a previous comment instead of making new comments.
@driazati @areusch
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] github-actions[bot] commented on pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #11909:
URL: https://github.com/apache/tvm/pull/11909#issuecomment-1167891541
Built docs for commit 9c462ead5a9e457c4a0f7a79771297a6d728beed can be found [here](https://pr-docs.tlcpack.ai/PR-11909/5/docs/index.html).
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] driazati commented on a diff in pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] driazati commented on a diff in pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
driazati commented on code in PR #11909:
URL: https://github.com/apache/tvm/pull/11909#discussion_r908860191
##########
tests/scripts/github_docs_comment.py:
##########
@@ -25,11 +25,22 @@
from git_utils import git, GitHubRepo, parse_remote
from cmd_utils import init_log
+DOCS_BOT_MARKER = "<!---docs-bot-comment-->"
Review Comment:
```suggestion
DOCS_BOT_MARKER = "<!---docs-bot-comment-->\n\n"
```
I tried it out manually in [this comment](https://github.com/apache/tvm/pull/11909#issuecomment-1167891541) and it apparently busts the parsing on GitHub, some newlines fixes it up though
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] driazati commented on a diff in pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
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
```
##########
tests/scripts/github_docs_comment.py:
##########
@@ -38,6 +49,22 @@ def get_pr_and_build_numbers(target_url):
return {"pr_number": pr_number, "build_number": build_number}
+def patch_comment(github, comment_url, body, docs_url):
+ try:
+ github.patch(comment_url, {"body": body})
+ except error.HTTPError as e:
+ logging.exception(f"Failed to patch docs comment {docs_url}: {e}")
+ exit(1)
+
+
+def post_comment(github, url, body, docs_url):
+ try:
+ github.post(url, {"body": body})
+ except error.HTTPError as e:
+ logging.exception(f"Failed to add docs comment {docs_url}: {e}")
+ exit(1)
Review Comment:
what does the error handling add? it seems like it would log the same info as the exception itself being thrown
```suggestion
github.post(url, {"body": body})
```
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] driazati commented on pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
driazati commented on PR #11909:
URL: https://github.com/apache/tvm/pull/11909#issuecomment-1167536812
@tvm-bot rerun
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] github-actions[bot] commented on pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #11909:
URL: https://github.com/apache/tvm/pull/11909#issuecomment-1167676684
Built docs for commit d4e7cf2866725940f6f1b79400e11c48e2b4f985 can be found [here](https://pr-docs.tlcpack.ai/PR-11909/3/docs/index.html).
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] driazati commented on pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
driazati commented on PR #11909:
URL: https://github.com/apache/tvm/pull/11909#issuecomment-1169263482
@tvm-bot rerun
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] gigiblender commented on a diff in pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
gigiblender commented on code in PR #11909:
URL: https://github.com/apache/tvm/pull/11909#discussion_r908870495
##########
tests/scripts/github_docs_comment.py:
##########
@@ -25,11 +25,22 @@
from git_utils import git, GitHubRepo, parse_remote
from cmd_utils import init_log
+DOCS_BOT_MARKER = "<!---docs-bot-comment-->"
Review Comment:
Interesting, I made the change.
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] github-actions[bot] commented on pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #11909:
URL: https://github.com/apache/tvm/pull/11909#issuecomment-1169376562
Built docs for commit ee597081684492e08a550f4ba7551017ffd1ac95 can be found [here](https://pr-docs.tlcpack.ai/PR-11909/7/docs/index.html).
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] driazati merged pull request #11909: Docs bot now edits previous comments
Posted by GitBox <gi...@apache.org>.
driazati merged PR #11909:
URL: https://github.com/apache/tvm/pull/11909
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org