From 978c56c128c3c8c28a802d5f94145336345bfdbe Mon Sep 17 00:00:00 2001 From: sarbjitgrewal Date: Fri, 15 Sep 2023 12:38:34 +0530 Subject: [PATCH] update pipeline --- pr_agent/servers/bitbucket_pipeline_runner.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pr_agent/servers/bitbucket_pipeline_runner.py b/pr_agent/servers/bitbucket_pipeline_runner.py index 8a967756..4781396a 100644 --- a/pr_agent/servers/bitbucket_pipeline_runner.py +++ b/pr_agent/servers/bitbucket_pipeline_runner.py @@ -1,6 +1,6 @@ import os from pr_agent.agent.pr_agent import PRAgent -import os +from pr_agent.config_loader import get_settings from pr_agent.tools.pr_reviewer import PRReviewer import asyncio @@ -8,9 +8,19 @@ 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", '') + bearer_token = os.environ.get('BITBUCKET_BEARER_TOKEN', None) + + # Check if required environment variables are set + if not bearer_token: + print("BITBUCKET_BEARER_TOKEN not set") + + # Set the environment variables in the settings + get_settings().set("BITBUCKET.BEARER_TOKEN", bearer_token) + 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()) \ No newline at end of file + asyncio.run(run_action()) +