Create a Pull Request Args: repo: The full name of the repository (e.g., 'owner/repo') title: The PR title body: The PR description head: The source branch base: The target branch
(self, repo: str, title: str, body: str, head: str, base: str)
| 36 | return {'status': -1, 'message': f'Authentication failed: {str(e)}'} |
| 37 | |
| 38 | def create_pull_request(self, repo: str, title: str, body: str, head: str, base: str) -> dict: |
| 39 | """ |
| 40 | Create a Pull Request |
| 41 | |
| 42 | Args: |
| 43 | repo: The full name of the repository (e.g., 'owner/repo') |
| 44 | title: The PR title |
| 45 | body: The PR description |
| 46 | head: The source branch |
| 47 | base: The target branch |
| 48 | """ |
| 49 | try: |
| 50 | url = f'{self.api_base}/repos/{repo}/pulls' |
| 51 | data = { |
| 52 | 'title': title, |
| 53 | 'body': body, |
| 54 | 'head': head, |
| 55 | 'base': base |
| 56 | } |
| 57 | response = self.session.post(url, json=data) |
| 58 | response.raise_for_status() |
| 59 | pr_data = response.json() |
| 60 | return { |
| 61 | 'status': 0, |
| 62 | 'message': f'PR created successfully: {pr_data["html_url"]}', |
| 63 | 'pr_url': pr_data['html_url'] |
| 64 | } |
| 65 | except Exception as e: |
| 66 | return {'status': -1, 'message': f'PR creation failed: {str(e)}'} |
| 67 | |
| 68 | |
| 69 |
no outgoing calls
no test coverage detected