-
Notifications
You must be signed in to change notification settings - Fork 6
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
Enhance PR Review with Claude 3.5 Sonnet and Improved Commit Display #5
Conversation
📖 WalkthroughEnhances the pull request review workflow by improving commit message display with clickable SHA links and detailed information. Sets Claude 3.5 Sonnet as the default LLM model and implements smarter overview comment handling by updating existing comments instead of creating duplicates. The changes improve the user interface for displaying commit and file information while streamlining the review process. Changes
autogenerated by presubmit.ai |
📖 WalkthroughThis PR improves the display of commit messages in the initial PR analysis comment by showing detailed commit information with links to each commit. It also explicitly sets the Claude 3.5 Sonnet model as the default LLM model both in the workflow configuration and environment variables. Changes
|
📖 WalkthroughEnhances the PR review workflow by improving commit message display with detailed information and clickable links. Sets Claude 3.5 Sonnet as the default LLM model both in workflow configuration and environment variables. Implements better handling of overview comments by updating existing ones instead of creating duplicates. Changes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review submitted
for (const commit of commits.reverse()) { | ||
message += `- [${commit.sha.slice( | ||
0, | ||
7 | ||
)}](https://github.com/${owner}/${repo}/commit/${commit.sha}): ${ | ||
commit.commit.message | ||
}\n`; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message formatting could be simplified using a single-line template literal for better readability. Consider refactoring to:
- message += `- [${commit.sha.slice(
- 0,
- 7
- )}](https://github.com/${owner}/${repo}/commit/${commit.sha}): ${
- commit.commit.message
- }\n`;
+ message += `- [${commit.sha.slice(0, 7)}](https://github.com/${owner}/${repo}/commit/${commit.sha}): ${commit.commit.message}\n`;
let overviewComment = comments.find((comment) => | ||
comment.body?.includes(OVERVIEW_MESSAGE_SIGNATURE) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're using the optional chaining operator (?.
), it's good practice to be explicit about null/undefined checks when searching for existing comments. Consider adding a null check:
- let overviewComment = comments.find((comment) =>
- comment.body?.includes(OVERVIEW_MESSAGE_SIGNATURE)
- );
+ let overviewComment = comments.find((comment) =>
comment.body && comment.body.includes(OVERVIEW_MESSAGE_SIGNATURE)
);
@@ -11,12 +11,13 @@ on: | |||
types: [created] | |||
|
|||
jobs: | |||
review: | |||
Review: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The job name Review
uses PascalCase while typical GitHub Actions job names use kebab-case or snake_case for better consistency with other workflows. Consider renaming to:
- Review:
+ code-review:
LLM_MODEL: "claude-3-5-sonnet-20241022" | ||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }} | ||
with: | ||
llm_model: "claude-3-5-sonnet-20241022" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LLM model is specified both as an environment variable and as an input parameter. This creates redundancy and potential for inconsistency. Consider using only one method to specify the model:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- LLM_MODEL: "claude-3-5-sonnet-20241022"
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
with:
llm_model: "claude-3-5-sonnet-20241022"
Enhances the pull request review workflow by improving commit message display with clickable SHA links and detailed information. Sets Claude 3.5 Sonnet as the default LLM model and implements smarter overview comment handling by updating existing comments instead of creating duplicates. The changes improve the user interface for displaying commit and file information while streamlining the review process.