openhands.resolver.send_pull_request
apply_patch
def apply_patch(repo_dir: str, patch: str) -> None
Apply a patch to a repository.
Arguments:
repo_dir
- The directory containing the repositorypatch
- The patch to apply
initialize_repo
def initialize_repo(output_dir: str,
issue_number: int,
issue_type: str,
base_commit: str | None = None) -> str
Initialize the repository.
Arguments:
output_dir
- The output directory to write the repository toissue_number
- The issue number to fixissue_type
- The type of the issuebase_commit
- The base commit to checkout (if issue_type is pr)
make_commit
def make_commit(repo_dir: str, issue: GithubIssue, issue_type: str) -> None
Make a commit with the changes to the repository.
Arguments:
repo_dir
- The directory containing the repositoryissue
- The issue to fixissue_type
- The type of the issue
branch_exists
def branch_exists(base_url: str, branch_name: str, headers: dict) -> bool
Check if a branch exists in the GitHub repository.
Arguments:
base_url
- The base URL of the GitHub repository APIbranch_name
- The name of the branch to checkheaders
- The HTTP headers to use for authentication
send_pull_request
def send_pull_request(github_issue: GithubIssue,
github_token: str,
github_username: str | None,
patch_dir: str,
pr_type: str,
fork_owner: str | None = None,
additional_message: str | None = None,
target_branch: str | None = None,
reviewer: str | None = None,
pr_title: str | None = None) -> str
Send a pull request to a GitHub repository.
Arguments:
github_issue
- The issue to send the pull request forgithub_token
- The GitHub token to use for authenticationgithub_username
- The GitHub username, if providedpatch_dir
- The directory containing the patches to applypr_type
- The type: branch (no PR created), draft or ready (regular PR created)fork_owner
- The owner of the fork to push changes to (if different from the original repo owner)additional_message
- The additional messages to post as a comment on the PR in json list formattarget_branch
- The target branch to create the pull request against (defaults to repository default branch)reviewer
- The GitHub username of the reviewer to assignpr_title
- Custom title for the pull request (optional)
reply_to_comment
def reply_to_comment(github_token: str, comment_id: str, reply: str)
Reply to a comment on a GitHub issue or pull request.
Arguments:
github_token
- The GitHub token to use for authenticationcomment_id
- The ID of the comment to reply toreply
- The reply message to post
send_comment_msg
def send_comment_msg(base_url: str, issue_number: int, github_token: str,
msg: str)
Send a comment message to a GitHub issue or pull request.
Arguments:
base_url
- The base URL of the GitHub repository APIissue_number
- The issue or pull request numbergithub_token
- The GitHub token to use for authenticationmsg
- The message content to post as a comment
update_existing_pull_request
def update_existing_pull_request(github_issue: GithubIssue,
github_token: str,
github_username: str | None,
patch_dir: str,
llm_config: LLMConfig,
comment_message: str | None = None,
additional_message: str | None = None) -> str
Update an existing pull request with the new patches.
Arguments:
github_issue
- The issue to update.github_token
- The GitHub token to use for authentication.github_username
- The GitHub username to use for authentication.patch_dir
- The directory containing the patches to apply.llm_config
- The LLM configuration to use for summarizing changes.comment_message
- The main message to post as a comment on the PR.additional_message
- The additional messages to post as a comment on the PR in json list format.