add bitbucket pipeline

This commit is contained in:
sarbjitgrewal
2023-09-11 16:08:23 +05:30
parent ca8997b616
commit 12bd9e8b42
6 changed files with 91 additions and 7 deletions

View File

@ -0,0 +1,16 @@
import os
from pr_agent.agent.pr_agent import PRAgent
import os
from pr_agent.tools.pr_reviewer import PRReviewer
import asyncio
async def run_action():
pull_request_id = os.environ.get("BITBUCKET_PR_ID", '')
slug = os.environ.get("BITBUCKET_REPO_SLUG", '')
workspace = os.environ.get("BITBUCKET_WORKSPACE", '')
if pull_request_id and slug and workspace:
pr_url = f"https://bitbucket.org/{workspace}/{slug}/pull-requests/{pull_request_id}"
await PRReviewer(pr_url).run()
if __name__ == "__main__":
asyncio.run(run_action())

View File

@ -1,7 +1,7 @@
[config]
model="gpt-4"
fallback_models=["gpt-3.5-turbo-16k"]
git_provider="github"
git_provider="bitbucket"
publish_output=true
publish_output_progress=true
verbosity_level=0 # 0,1,2
@ -50,6 +50,7 @@ extra_instructions = ""
[github]
# The type of deployment to create. Valid values are 'app' or 'user'.
deployment_type = "user"
user_token = "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" # A GitHub personal access token with 'repo' scope.
ratelimit_retries = 5
[github_app]
@ -95,6 +96,21 @@ polling_interval_seconds = 30
# token to authenticate in the patch server
# patch_server_token = ""
[openai]
key = "" # Acquire through https://platform.openai.com
#org = "<ORGANIZATION>" # Optional, may be commented out.
# Uncomment the following for Azure OpenAI
#api_type = "azure"
#api_version = '2023-05-15' # Check Azure documentation for the current API version
#api_base = "" # The base URL for your Azure OpenAI resource. e.g. "https://<your resource name>.openai.azure.com"
#deployment_id = "" # The deployment name you chose when you deployed the engine
#fallback_deployments = [] # For each fallback model specified in configuration.toml in the [config] section, specify the appropriate deployment_id
[bitbucket]
# Bitbucket personal bearer token
bearer_token = "V7w1WLUjFIoTQYijE7qgaUArjl75tHSJwCkiqNjCnHVKJCZ6J3r0UUjSP5OYrzTedjT4oXVX4BSWZoiEpdMBXFg8ACpt8wrgAm9zZqGgPiKYMi46E-QtVhHtIFh3PCE="
[litellm]
#use_client = false

View File

@ -75,12 +75,15 @@ class PRDescription:
if get_settings().pr_description.publish_description_as_comment:
self.git_provider.publish_comment(pr_body)
else:
self.git_provider.publish_description(pr_title, pr_body)
if self.git_provider.is_supported("get_labels"):
current_labels = self.git_provider.get_labels()
if current_labels is None:
current_labels = []
self.git_provider.publish_labels(pr_types + current_labels)
if get_settings().config.git_provider == 'bitbucket':
self.git_provider.publish_description(pr_title, description)
else:
self.git_provider.publish_description(pr_title, pr_body)
if self.git_provider.is_supported("get_labels"):
current_labels = self.git_provider.get_labels()
if current_labels is None:
current_labels = []
self.git_provider.publish_labels(pr_types + current_labels)
self.git_provider.remove_initial_comment()
return ""