MCPcopy Create free account
hub / github.com/pollinations/pollinations / get_pr_diff

Method get_pr_diff

apps/polly/src/services/github_pr.py:363–384  ·  view source on GitHub ↗

Get the unified diff for a PR.

(self, pr_number: int)

Source from the content-addressed store, hash-verified

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."""

Callers 2

review_prMethod · 0.95
tool_github_prFunction · 0.80

Calls 6

_has_authMethod · 0.95
_get_headersMethod · 0.95
get_sessionMethod · 0.95
errorMethod · 0.80
getMethod · 0.65
textMethod · 0.65

Tested by

no test coverage detected