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

Commit

Permalink
Max files (#84)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by openai -->
### Summary by OpenAI

Chore: Limit the number of files summarized and reviewed based on
configurable options. Default values for these options have been changed
to 40 and 0 respectively.
<!-- end of auto-generated comment: release notes by openai -->
  • Loading branch information
harjotgill authored Mar 24, 2023
1 parent 009542a commit 1ad7668
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ inputs:
required: false
description:
'Max files to summarize. Less than or equal to 0 means no limit.'
default: '60'
default: '40'
max_files_to_review:
required: false
description: 'Max files to review. Less than or equal to 0 means no limit.'
default: '180'
default: '0'
review_comment_lgtm:
required: false
description: 'Leave comments even if the patch is LGTM'
Expand Down
11 changes: 5 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ export class Options {

constructor(
debug: boolean,
max_files_to_summarize = '60',
max_files_to_review = '180',
max_files_to_summarize = '40',
max_files_to_review = '0',
review_comment_lgtm = false,
path_filters: string[] | null = null,
system_message = '',
Expand Down
13 changes: 8 additions & 5 deletions src/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ export const codeReview = async (
const summaryPromises = []
const skipped_files_to_summarize = []
for (const [filename, file_content, file_diff] of files_to_review) {
if (summaryPromises.length < options.max_files_to_summarize) {
if (
options.max_files_to_summarize <= 0 ||
summaryPromises.length < options.max_files_to_summarize
) {
summaryPromises.push(
openai_concurrency_limit(async () =>
generateSummary(filename, file_content, file_diff)
Expand Down Expand Up @@ -403,9 +406,6 @@ ${
}

// Use Promise.all to run file review processes in parallel
// rewrite this to take max_files_to_review limit into account
// const reviewPromises = files_to_review.map(
// async ([filename, file_content, file_diff, patches]) =>
// openai_concurrency_limit(async () =>
// review(filename, file_content, file_diff, patches)
// )
Expand All @@ -418,7 +418,10 @@ ${
file_diff,
patches
] of files_to_review) {
if (reviewPromises.length < options.max_files_to_review) {
if (
options.max_files_to_review <= 0 ||
reviewPromises.length < options.max_files_to_review
) {
reviewPromises.push(
openai_concurrency_limit(async () =>
review(filename, file_content, file_diff, patches)
Expand Down

0 comments on commit 1ad7668

Please sign in to comment.