Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request includes several changes to the
cmd/review
package. Theconfig.go
file has been updated to include options for GitHub and OpenAI tokens, GitHub owner, repo, and pull request number, as well as a test mode option. Themain.go
file has been refactored to extract file processing logic into a separate function and return comments generated from processing files using the OpenAI API. Unused imports and command line arguments have also been removed. Thereview.go
file has been updated to include a new functionprocessFiles
to process files and extract reviews from them using OpenAI API. If the review is not good, it creates a new comment on the pull request with the issue description and line number. A new functioncreateComments
has also been added to create comments on the pull request using GitHub API. Theutils.go
file has been updated to include a function to extract a JSON object from a string input and return it as a Review struct. Theutils_test.go
file has been updated to include a new test functionTest_extractReviewFromString
to parse review strings and return the expectedReview
struct. Finally, thego.mod
file has been updated to includegolang.org/x/oauth2 v0.6.0
as a required dependency.Changes
cmd/review/config.go
to include options for GitHub and OpenAI tokens, GitHub owner, repo, and pull request number, as well as a test mode option.cmd/review/main.go
to extract file processing logic into a separate function and return comments generated from processing files using the OpenAI API. Removed unused imports and command line arguments.cmd/review/review.go
to include a new functionprocessFiles
to process files and extract reviews from them using OpenAI API. If the review is not good, it creates a new comment on the pull request with the issue description and line number. Added a new functioncreateComments
to create comments on the pull request using GitHub API.cmd/review/utils.go
to include a function to extract a JSON object from a string input and return it as a Review struct.cmd/review/utils_test.go
to include a new test functionTest_extractReviewFromString
to parse review strings and return the expectedReview
struct.go.mod
to includegolang.org/x/oauth2 v0.6.0
as a required dependency.