Add logging context to command execution in pr_agent.py

This commit is contained in:
Ori Kotek
2024-02-15 12:13:56 +02:00
parent bd88c66717
commit 433b8d24b8

View File

@ -69,20 +69,21 @@ class PRAgent:
args = update_settings_from_args(args) args = update_settings_from_args(args)
action = action.lstrip("/").lower() action = action.lstrip("/").lower()
if action == "reflect_and_review": with get_logger().contextualize(command=action):
get_settings().pr_reviewer.ask_and_reflect = True if action == "reflect_and_review":
if action == "answer": get_settings().pr_reviewer.ask_and_reflect = True
if notify: if action == "answer":
notify() if notify:
await PRReviewer(pr_url, is_answer=True, args=args, ai_handler=self.ai_handler).run() notify()
elif action == "auto_review": await PRReviewer(pr_url, is_answer=True, args=args, ai_handler=self.ai_handler).run()
await PRReviewer(pr_url, is_auto=True, args=args, ai_handler=self.ai_handler).run() elif action == "auto_review":
elif action in command2class: await PRReviewer(pr_url, is_auto=True, args=args, ai_handler=self.ai_handler).run()
if notify: elif action in command2class:
notify() if notify:
notify()
await command2class[action](pr_url, ai_handler=self.ai_handler, args=args).run()
else: await command2class[action](pr_url, ai_handler=self.ai_handler, args=args).run()
return False else:
return True return False
return True