Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run review for a PR in bitbucket #1451

Open
IgorGanapolsky opened this issue Jan 13, 2025 · 4 comments
Open

Unable to run review for a PR in bitbucket #1451

IgorGanapolsky opened this issue Jan 13, 2025 · 4 comments
Labels

Comments

@IgorGanapolsky
Copy link

I tried your instructions and put the proper access keys in the script. But it gives this error:

/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/.venv/bin/python /Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/start.py
Traceback (most recent call last):
File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/start.py", line 1, in
from pr_agent import cli
File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/cli.py", line 5, in
from pr_agent.agent.pr_agent import PRAgent, commands
File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/agent/pr_agent.py", line 8, in
from pr_agent.git_providers.utils import apply_repo_settings
File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/git_providers/init.py", line 5, in
from pr_agent.git_providers.bitbucket_provider import BitbucketProvider
File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/git_providers/bitbucket_provider.py", line 27, in
class BitbucketProvider(GitProvider):
File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/git_providers/bitbucket_provider.py", line 439, in BitbucketProvider
def get_pr_owner_id(self) -> str | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Process finished with exit code 1

@mrT23
Copy link
Collaborator

mrT23 commented Jan 14, 2025

Your command line, or your configuration, (which you have not shared) are wrong

@IgorGanapolsky
Copy link
Author

I followed the instructions, here is the setup:

from pr_agent import cli
from pr_agent.config_loader import get_settings

def main():
    # Fill in the following values
    provider = "bitbucket" # github/gitlab/bitbucket/azure_devops
    user_token = "my token...."  #  user token
    openai_key = "my keyl...."  # OpenAI key
    pr_url = "https://bitbucket.org/my_repo_pr_link"      # PR URL, for example 'https://github.com/Codium-ai/pr-agent/pull/809'
    command = "/review" # Command to run (e.g. '/review', '/describe', '/ask="What is the purpose of this PR?"', ...)

    # Setting the configurations
    get_settings().set("CONFIG.git_provider", provider)
    get_settings().set("openai.key", openai_key)
    get_settings().set("github.user_token", user_token)

    # Run the command. Feedback will appear in GitHub PR comments
    cli.run_command(pr_url, command)


if __name__ == '__main__':
    main()

@mrT23 mrT23 added the answered label Jan 14, 2025
@mrT23
Copy link
Collaborator

mrT23 commented Jan 14, 2025

how can 'github.user_token' be relevant for bitbucket ??

the example you are using is for github.

you need to edit the script to be similar to this:

image

all the best

@IgorGanapolsky
Copy link
Author

IgorGanapolsky commented Jan 14, 2025

@mrT23 Good point. Changed. But still error:

Traceback (most recent call last):
  File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/start.py", line 1, in <module>
    from pr_agent import cli
  File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/cli.py", line 5, in <module>
    from pr_agent.agent.pr_agent import PRAgent, commands
  File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/agent/pr_agent.py", line 8, in <module>
    from pr_agent.git_providers.utils import apply_repo_settings
  File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/git_providers/__init__.py", line 5, in <module>
    from pr_agent.git_providers.bitbucket_provider import BitbucketProvider
  File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/git_providers/bitbucket_provider.py", line 27, in <module>
    class BitbucketProvider(GitProvider):
  File "/Users/igorganapolsky/workspace/git/Codium-ai/pr-agent/pr_agent/git_providers/bitbucket_provider.py", line 439, in BitbucketProvider
    def get_pr_owner_id(self) -> str | None:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants