Improve handling of too-large PR diff (#465)

This commit is contained in:
Glenn Jocher
2025-05-24 12:08:26 +02:00
committed by GitHub
parent 0b21d744b5
commit 93b5d0b41b
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -22,4 +22,4 @@
# ├── test_summarize_pr.py
# └── ...
__version__ = "0.0.82"
__version__ = "0.0.83"
+6 -1
View File
@@ -115,7 +115,12 @@ class Action:
"""Retrieves the diff content for a specified pull request."""
url = f"{GITHUB_API_URL}/repos/{self.repository}/pulls/{self.pr.get('number')}"
response = self.get(url, headers=self.headers_diff)
return response.text if response.status_code == 200 else ""
if response.status_code == 200:
return response.text
elif response.status_code == 406:
return "**ERROR: DIFF TOO LARGE - PR exceeds GitHub's 20,000 line limit, unable to retrieve diff."
else:
return "**ERROR: UNABLE TO RETRIEVE DIFF."
def get_repo_data(self, endpoint: str) -> dict:
"""Fetches repository data from a specified endpoint."""