Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 130ae46

Browse files
authored
collapse skipped files lists (#95)
1 parent adb8903 commit 130ae46

File tree

2 files changed

+80
-49
lines changed

2 files changed

+80
-49
lines changed

dist/index.js

Lines changed: 36 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/review.ts

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -225,32 +225,42 @@ ${filename}: ${summary}
225225

226226
const summarize_comment = `${summarize_final_response}
227227
228-
${
229-
filter_ignored_files.length > 0
230-
? `
231228
---
232229
233-
### Files ignored due to filter (${filter_ignored_files.length})
234-
- ${filter_ignored_files.map(file => file.filename).join('\n- ')}
230+
### Chat with 🤖 OpenAI Bot (\`@openai\`)
231+
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
232+
- Invite the bot into a review comment chain by tagging \`@openai\` in a reply.
233+
234+
---
235+
236+
${filter_ignored_files.length > 0
237+
? `
238+
<details>
239+
<summary>Files ignored due to filter (${filter_ignored_files.length})</summary>
240+
241+
### Ignored files
242+
243+
* ${filter_ignored_files.map(file => file.filename).join('\n* ')}
244+
245+
</details>
235246
`
236-
: ''
237-
}
247+
: ''
248+
}
238249
239-
${
240-
skipped_files_to_summarize.length > 0
241-
? `
242-
### Files not summarized due to max files limit (${
243-
skipped_files_to_summarize.length
244-
})
245-
- ${skipped_files_to_summarize.join('\n - ')}`
246-
: ''
247-
}
250+
${skipped_files_to_summarize.length > 0
251+
? `
252+
<details>
253+
<summary>Files not summarized due to max files limit (${skipped_files_to_summarize.length
254+
})</summary>
248255
249-
---
256+
### Not summarized
250257
251-
### Chat with 🤖 OpenAI Bot (\`@openai\`)
252-
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
253-
- Invite the bot into a review comment chain by tagging \`@openai\` in a reply.
258+
* ${skipped_files_to_summarize.join('\n* ')}
259+
260+
</details>
261+
`
262+
: ''
263+
}
254264
`
255265

256266
next_summarize_ids = summarize_final_response_ids
@@ -445,22 +455,25 @@ ${
445455

446456
// comment about skipped files for review and summarize
447457
if (skipped_files_to_review.length > 0) {
448-
const tag = '<!-- openai-skipped-files -->'
449458
// make bullet points for skipped files
450459
const comment = `
451-
${tag}
460+
${skipped_files_to_review.length > 0
461+
? `<details>
462+
<summary>Files not reviewed due to max files limit (${skipped_files_to_review.length
463+
})</summary>
452464
453-
${
454-
skipped_files_to_review.length > 0
455-
? `
456-
### Files not reviewed due to max files limit (${
457-
skipped_files_to_review.length
458-
})
459-
- ${skipped_files_to_review.join('\n - ')}`
465+
### Not reviewed
466+
467+
* ${skipped_files_to_review.join('\n* ')}
468+
469+
</details>
470+
`
460471
: ''
461-
}
472+
}
462473
`
463-
await commenter.comment(comment, tag, 'replace')
474+
if (comment.length > 0) {
475+
await commenter.comment(comment, SUMMARIZE_TAG, 'append')
476+
}
464477
}
465478
}
466479
}

0 commit comments

Comments
 (0)