areusch commented on code in PR #11480:
URL: https://github.com/apache/tvm/pull/11480#discussion_r887257802
##########
tests/scripts/github_tvmbot.py:
##########
@@ -539,21 +589,35 @@ def merge_if_passed_checks(self) -> None:
else:
pr = PR(number=int(args.pr), owner=owner, repo=repo,
dry_run=args.dry_run)
+ # Acknowledge the comment with a react
+ pr.plus_one(comment)
+
+ # Check the comment author
+ comment_author = comment["user"]["login"]
+ if pr.author() == comment_author:
+ logging.info("Comment user is PR author, continuing")
+ else:
+ logging.info("Comment is not from PR author, checking collaborators")
+ # Get the list of collaborators for the repo filtered by the comment
+ # author
+ if args.testing_collaborators_json:
+ collaborators = json.loads(args.testing_collaborators_json)
+ else:
+ collaborators = pr.search_collaborator(comment_author)
+ logging.info(f"Found collaborators: {collaborators}")
+
+ if len(collaborators) > 0:
+ logging.info("Comment is from collaborator")
+ else:
+ logging.info("Comment is not from from PR author or collaborator,
quitting")
+ exit(0)
+
state = pr.state()
if state != "OPEN":
logging.info(f"Ignoring event on PR, state was not OPEN, instead was
state={state}")
exit(0)
- if pr.merge_requested():
- try:
- pr.merge_if_passed_checks()
- except Exception as e:
- if not args.dry_run:
- msg = traceback.format_exc()
- pr.comment(
- f"Failed to process merge request in
{args.run_url}\n\n<details>\n\n```\n{msg}\n```\n\n</details>"
- )
- raise e
- else:
- logging.info("No merge requested, exiting")
+ # Run the command
+ command_to_run.run(pr)
+ # exit(1)
Review Comment:
uncomment?
--
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]