mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-22 03:18:54 +08:00
feat(context): include diffHunk in PR review comment context (#1584)
* feat(context): include diffHunk in PR review comment context Review comments arrived with only path and line, so the code they were written against was missing from the prompt. Fetch diffHunk in the PR GraphQL query and render it under the comment as a diff block. The hunk is PR-authored content, so it goes through sanitizeContent like the comment body. Comments without a hunk are unchanged. Fixes #855 * test(formatter): cover outdated review comments with an empty diff hunk GitHub returns diffHunk: "" (not null) for comments whose line no longer exists in the diff, so the render guard has to reject empty strings too. Found running the real query against anthropics/claude-code-action#1025.
This commit is contained in:
@@ -22,6 +22,7 @@ export type GitHubComment = {
|
||||
export type GitHubReviewComment = GitHubComment & {
|
||||
path: string;
|
||||
line: number | null;
|
||||
diffHunk?: string | null;
|
||||
};
|
||||
|
||||
export type GitHubCommit = {
|
||||
|
||||
Reference in New Issue
Block a user