Get the unified diff for a PR.
(self, pr_number: int)
| 361 | return {"error": str(e)} |
| 362 | |
| 363 | async def get_pr_diff(self, pr_number: int) -> dict: |
| 364 | """Get the unified diff for a PR.""" |
| 365 | if not self._has_auth(): |
| 366 | return {"error": "GitHub token not configured"} |
| 367 | |
| 368 | url = f"https://api.github.com/repos/{self.repo}/pulls/{pr_number}" |
| 369 | headers = await self._get_headers() |
| 370 | headers["Accept"] = "application/vnd.github.v3.diff" |
| 371 | |
| 372 | try: |
| 373 | session = await self.get_session() |
| 374 | async with session.get(url, headers=headers) as response: |
| 375 | if response.status == 200: |
| 376 | diff = await response.text() |
| 377 | return {"pr_number": pr_number, "diff": diff} |
| 378 | elif response.status == 404: |
| 379 | return {"error": f"PR #{pr_number} not found", "not_found": True} |
| 380 | else: |
| 381 | return {"error": f"GitHub API error: {response.status}"} |
| 382 | except Exception as e: |
| 383 | logger.error(f"Error getting PR diff: {e}") |
| 384 | return {"error": str(e)} |
| 385 | |
| 386 | async def get_pr_checks(self, pr_number: int) -> dict: |
| 387 | """Get CI/workflow status for a PR using GraphQL statusCheckRollup.""" |
no test coverage detected