Skip to content

Commit 5efd0b7

Browse files
Copilotparkerbxyz
andauthored
fix: add draft review comments to debug logs (#106)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: parkerbxyz <17183625+parkerbxyz@users.noreply.github.com>
1 parent 702f9ec commit 5efd0b7

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

dist/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59509,6 +59509,25 @@ async function run({
5950959509
parsedDiff,
5951059510
existingCommentKeys
5951159511
)
59512+
if (initialComments.length) {
59513+
(0,core.debug)(`Generated suggestions: ${initialComments.length}`)
59514+
for (const comment of initialComments) {
59515+
;(0,core.debug)(`- Draft review comment:`)
59516+
;(0,core.debug)(` path: ${comment.path}`)
59517+
;(0,core.debug)(` line: ${comment.line}`)
59518+
if (comment.start_line !== undefined) {
59519+
(0,core.debug)(` start_line: ${comment.start_line}`)
59520+
}
59521+
if (comment.start_side !== undefined) {
59522+
(0,core.debug)(` start_side: ${comment.start_side}`)
59523+
}
59524+
(0,core.debug)(` body:`)
59525+
const indentedBody = comment.body.split('\n').map(line => ` ${line}`).join('\n')
59526+
;(0,core.debug)(indentedBody)
59527+
}
59528+
} else {
59529+
(0,core.debug)('Generated suggestions: 0')
59530+
}
5951259531
const comments = await filterSuggestionsInPullRequestDiff({
5951359532
octokit,
5951459533
owner,

index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,25 @@ export async function run({
514514
parsedDiff,
515515
existingCommentKeys
516516
)
517+
if (initialComments.length) {
518+
debug(`Generated suggestions: ${initialComments.length}`)
519+
for (const comment of initialComments) {
520+
debug(`- Draft review comment:`)
521+
debug(` path: ${comment.path}`)
522+
debug(` line: ${comment.line}`)
523+
if (comment.start_line !== undefined) {
524+
debug(` start_line: ${comment.start_line}`)
525+
}
526+
if (comment.start_side !== undefined) {
527+
debug(` start_side: ${comment.start_side}`)
528+
}
529+
debug(` body:`)
530+
const indentedBody = comment.body.split('\n').map(line => ` ${line}`).join('\n')
531+
debug(indentedBody)
532+
}
533+
} else {
534+
debug('Generated suggestions: 0')
535+
}
517536
const comments = await filterSuggestionsInPullRequestDiff({
518537
octokit,
519538
owner,

0 commit comments

Comments
 (0)