fix(blocks): Restore GithubReadPullRequestBlock diff output (#10256)

- Follow-up fix to #10138

AI erased a bit of functionality from the `GithubReadPullRequestBlock`
in #10138. This PR puts it back and improves on the old format.

### Changes 🏗️

- Include full diff in `changes` output of `GithubReadPullRequestBlock`

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [ ] I have tested my changes according to the test plan:
- Use the `GithubReadPullRequestBlock` with `include_pr_changes` enabled
  - [ ] -> block runs successfully
  - [ ] -> full diff included in `changes` output
This commit is contained in:
Reinier van der Leer
2025-06-27 16:05:31 +01:00
committed by GitHub
parent cf560c5d65
commit c01beaf003

View File

@@ -265,10 +265,26 @@ class GithubReadPullRequestBlock(Block):
files = response.json()
changes = []
for file in files:
filename = file.get("filename", "")
status = file.get("status", "")
changes.append(f"{filename}: {status}")
return "\n".join(changes)
status: str = file.get("status", "")
diff: str = file.get("patch", "")
if status != "removed":
is_filename: str = file.get("filename", "")
was_filename: str = (
file.get("previous_filename", is_filename)
if status != "added"
else ""
)
else:
is_filename = ""
was_filename: str = file.get("filename", "")
patch_header = ""
if was_filename:
patch_header += f"--- {was_filename}\n"
if is_filename:
patch_header += f"+++ {is_filename}\n"
changes.append(patch_header + diff)
return "\n\n".join(changes)
async def run(
self,