Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor review #12

Merged
merged 2 commits into from
May 7, 2023
Merged

refactor review #12

merged 2 commits into from
May 7, 2023

Conversation

ravilushqa
Copy link
Owner

@ravilushqa ravilushqa commented May 7, 2023

Description

This pull request includes several changes to the cmd/review package. The config.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. The main.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. The review.go file has been updated to include a new function processFiles 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 function createComments has also been added to create comments on the pull request using GitHub API. The utils.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. The utils_test.go file has been updated to include a new test function Test_extractReviewFromString to parse review strings and return the expected Review struct. Finally, the go.mod file has been updated to include golang.org/x/oauth2 v0.6.0 as a required dependency.

Changes

  • Updated 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.
  • Refactored 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.
  • Updated cmd/review/review.go to include a new function processFiles 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 function createComments to create comments on the pull request using GitHub API.
  • Updated cmd/review/utils.go to include a function to extract a JSON object from a string input and return it as a Review struct.
  • Updated cmd/review/utils_test.go to include a new test function Test_extractReviewFromString to parse review strings and return the expected Review struct.
  • Updated go.mod to include golang.org/x/oauth2 v0.6.0 as a required dependency.

@ravilushqa ravilushqa merged commit dfde636 into main May 7, 2023
@ravilushqa ravilushqa deleted the refactor_review branch May 7, 2023 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant