Submit a Pull Request Args: title: PR title body: PR description target_branch: target branch
(title: str, body: str, target_branch: str)
| 89 | |
| 90 | @register_tool("submit_pull_request") |
| 91 | def submit_pull_request(title: str, body: str, target_branch: str): |
| 92 | """ |
| 93 | Submit a Pull Request |
| 94 | |
| 95 | Args: |
| 96 | title: PR title |
| 97 | body: PR description |
| 98 | target_branch: target branch |
| 99 | """ |
| 100 | # initialize GitHub client |
| 101 | github = GitHubClient(GITHUB_AI_TOKEN) |
| 102 | |
| 103 | # check authentication |
| 104 | auth_result = github.check_auth() |
| 105 | if auth_result['status'] != 0: |
| 106 | return auth_result |
| 107 | |
| 108 | # create a pull request |
| 109 | pr_result = github.create_pull_request( |
| 110 | repo="tjb-tech/autoagent", |
| 111 | title=title, |
| 112 | body=body, |
| 113 | head=get_current_branch(), |
| 114 | base=target_branch |
| 115 | ) |
| 116 | if pr_result['status'] == 0: |
| 117 | return f"PR created successfully: {json.dumps(pr_result, indent=4)}" |
| 118 | else: |
| 119 | return f"PR creation failed: {json.dumps(pr_result, indent=4)}" |
| 120 | |
| 121 | # def create_pull_request(title, body, target_branch): |
| 122 | # """ |
no test coverage detected