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

Commit 398d754

Browse files
authored
Max files (#214)
<!-- This is an auto-generated comment: release notes by openai --> ### Summary by OpenAI ## Release Notes - New Feature: Added triage system for evaluating diffs in the codebase. - Bug fix: Changed `[COMPLEXITY]` tag to `[TRIAGE]` to determine if a file needs review. - Chore: Updated `max_files` input parameter to have a default value of 150 instead of 0. > "Code complexity, oh what a mess, > But fear not, we've made progress! > With triage and tags, we'll sort it out, > And make our codebase scream and shout!" <!-- end of auto-generated comment: release notes by openai -->
1 parent bf2661b commit 398d754

File tree

4 files changed

+41
-47
lines changed

4 files changed

+41
-47
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ inputs:
1414
description:
1515
'Max files to summarize and review. Less than or equal to 0 means no
1616
limit.'
17-
default: '0'
17+
default: '150'
1818
review_comment_lgtm:
1919
required: false
2020
description: 'Leave comments even if the patch is LGTM'

dist/index.js

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

src/options.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,22 @@ export class Prompts {
2929
render_summarize_file_diff(inputs: Inputs): string {
3030
const prompt = `${this.summarize_file_diff}
3131
32-
Below the summary, I would also like you to classify the complexity
33-
of the diff as \`COMPLEX\` or \`SIMPLE\` based on the following
32+
Below the summary, I would also like you to triage the diff
33+
as \`NEEDS_REVIEW\` or \`APPROVED\` based on the following
3434
criteria:
3535
36-
- If the diff introduces new functionality, modifies existing logic
37-
significantly, or has potential security implications,
38-
classify it as \`COMPLEX\`.
36+
- If the diff introduces new functionality, modifies existing logic,
37+
or has potential for bugs, triage it as \`NEEDS_REVIEW\`.
3938
- If the diff only contains minor changes, such as fixing typos,
40-
formatting, or updating documentation, classify it as \`SIMPLE\`.
39+
formatting, renaming variables, triage it as \`APPROVED\`.
4140
4241
Please evaluate the diff thoroughly and take into account factors
4342
such as the number of lines changed, the potential impact on the
4443
overall system, and the likelihood of introducing new bugs or
4544
security vulnerabilities.
4645
47-
Use the following format to classify the complexity of the diff
48-
and add no additional text:
49-
[COMPLEXITY]: <COMPLEX or SIMPLE>
46+
Use the following format to triage the diff and add no additional text:
47+
[TRIAGE]: <NEEDS_REVIEW or APPROVED>
5048
`
5149

5250
return inputs.render(prompt)

src/review.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -269,22 +269,21 @@ ${hunks.old_hunk}
269269
summaries_failed.push(`${filename} (nothing obtained from openai)`)
270270
return null
271271
} else {
272-
// parse the comment to look for complexity classification
273-
// Format is : [COMPLEXITY]: <COMPLEX or SIMPLE>
274-
// if the change is complex return true, else false
275-
const complexityRegex = /\[COMPLEXITY\]:\s*(COMPLEX|SIMPLE)/
276-
const complexityMatch = summarize_resp.match(complexityRegex)
272+
// parse the comment to look for triage classification
273+
// Format is : [TRIAGE]: <NEEDS_REVIEW or APPROVED>
274+
// if the change needs review return true, else false
275+
const triageRegex = /\[TRIAGE\]:\s*(NEEDS_REVIEW|APPROVED)/
276+
const triageMatch = summarize_resp.match(triageRegex)
277277

278-
if (complexityMatch) {
279-
const complexity = complexityMatch[1]
280-
const is_complex = complexity === 'COMPLEX' ? true : false
278+
if (triageMatch) {
279+
const triage = triageMatch[1]
280+
const needs_review = triage === 'NEEDS_REVIEW' ? true : false
281281

282282
// remove this line from the comment
283-
const summary = summarize_resp.replace(complexityRegex, '').trim()
284-
core.info(`filename: ${filename}, complexity: ${complexity}`)
285-
return [filename, summary, is_complex]
283+
const summary = summarize_resp.replace(triageRegex, '').trim()
284+
core.info(`filename: ${filename}, triage: ${triage}`)
285+
return [filename, summary, needs_review]
286286
} else {
287-
// Handle the case when the [COMPLEXITY] tag is not found
288287
return [filename, summarize_resp, true]
289288
}
290289
}
@@ -439,11 +438,11 @@ ${
439438

440439
if (options.summary_only !== true) {
441440
const files_and_changes_review = files_and_changes.filter(([filename]) => {
442-
const is_complex =
441+
const needs_review =
443442
summaries.find(
444443
([summaryFilename]) => summaryFilename === filename
445444
)?.[2] ?? true
446-
return is_complex
445+
return needs_review
447446
})
448447

449448
const reviews_skipped = files_and_changes

0 commit comments

Comments
 (0)