mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
feat: Refactor auto tool execution order in bitbucket_app.py, add logging in pr_description.py, and update tool configuration instructions in Usage.md
This commit is contained in:
6
Usage.md
6
Usage.md
@ -240,9 +240,9 @@ inline_code_comments = true
|
|||||||
Each time you invoke a `/review` tool, it will use inline code comments.
|
Each time you invoke a `/review` tool, it will use inline code comments.
|
||||||
|
|
||||||
#### BitBucket Self-Hosted App automatic tools
|
#### BitBucket Self-Hosted App automatic tools
|
||||||
You can configure in your local `.pr_agent.toml` file conditions for which tools will **run automatically**.
|
You can configure in your local `.pr_agent.toml` file which tools will **run automatically** when a new PR is opened.
|
||||||
|
|
||||||
Specifically, start by setting the following environment variables:
|
Specifically, set the following values:
|
||||||
```yaml
|
```yaml
|
||||||
[bitbucket_app]
|
[bitbucket_app]
|
||||||
auto_review = true # set as config var in .pr_agent.toml
|
auto_review = true # set as config var in .pr_agent.toml
|
||||||
@ -250,7 +250,7 @@ auto_describe = true # set as config var in .pr_agent.toml
|
|||||||
auto_improve = true # set as config var in .pr_agent.toml
|
auto_improve = true # set as config var in .pr_agent.toml
|
||||||
```
|
```
|
||||||
|
|
||||||
`bitbucket_app.auto_review`, `bitbucket_app.auto_describe` and `bitbucket_app.auto_improve` are used to enable/disable automatic tools that run when a new PR is opened.
|
`bitbucket_app.auto_review`, `bitbucket_app.auto_describe` and `bitbucket_app.auto_improve` are used to enable/disable automatic tools.
|
||||||
If not set, the default option is that only the `review` tool will run automatically when a new PR is opened.
|
If not set, the default option is that only the `review` tool will run automatically when a new PR is opened.
|
||||||
|
|
||||||
### Changing a model
|
### Changing a model
|
||||||
|
@ -100,12 +100,12 @@ async def handle_github_webhooks(background_tasks: BackgroundTasks, request: Req
|
|||||||
auto_review = get_setting_or_env("BITBUCKET_APP.AUTO_REVIEW", None)
|
auto_review = get_setting_or_env("BITBUCKET_APP.AUTO_REVIEW", None)
|
||||||
if auto_review is None or is_true(auto_review): # by default, auto review is enabled
|
if auto_review is None or is_true(auto_review): # by default, auto review is enabled
|
||||||
await PRReviewer(pr_url).run()
|
await PRReviewer(pr_url).run()
|
||||||
auto_describe = get_setting_or_env("BITBUCKET_APP.AUTO_DESCRIBE", None)
|
|
||||||
if is_true(auto_describe): # by default, auto describe is disabled
|
|
||||||
await PRDescription(pr_url).run()
|
|
||||||
auto_improve = get_setting_or_env("BITBUCKET_APP.AUTO_IMPROVE", None)
|
auto_improve = get_setting_or_env("BITBUCKET_APP.AUTO_IMPROVE", None)
|
||||||
if is_true(auto_improve): # by default, auto improve is disabled
|
if is_true(auto_improve): # by default, auto improve is disabled
|
||||||
await PRCodeSuggestions(pr_url).run()
|
await PRCodeSuggestions(pr_url).run()
|
||||||
|
auto_describe = get_setting_or_env("BITBUCKET_APP.AUTO_DESCRIBE", None)
|
||||||
|
if is_true(auto_describe): # by default, auto describe is disabled
|
||||||
|
await PRDescription(pr_url).run()
|
||||||
# with get_logger().contextualize(**log_context):
|
# with get_logger().contextualize(**log_context):
|
||||||
# await agent.handle_request(pr_url, "review")
|
# await agent.handle_request(pr_url, "review")
|
||||||
elif event == "pullrequest:comment_created":
|
elif event == "pullrequest:comment_created":
|
||||||
|
@ -102,6 +102,7 @@ class PRDescription:
|
|||||||
if get_settings().config.publish_output:
|
if get_settings().config.publish_output:
|
||||||
get_logger().info(f"Pushing answer {self.pr_id}")
|
get_logger().info(f"Pushing answer {self.pr_id}")
|
||||||
if get_settings().pr_description.publish_description_as_comment:
|
if get_settings().pr_description.publish_description_as_comment:
|
||||||
|
get_logger().info(f"Publishing answer as comment")
|
||||||
self.git_provider.publish_comment(full_markdown_description)
|
self.git_provider.publish_comment(full_markdown_description)
|
||||||
else:
|
else:
|
||||||
self.git_provider.publish_description(pr_title, pr_body)
|
self.git_provider.publish_description(pr_title, pr_body)
|
||||||
|
Reference in New Issue
Block a user