Update claude-review.yml

This commit is contained in:
pacnpal
2024-12-10 16:47:26 -05:00
committed by GitHub
parent f55efc315d
commit 3e4429d34c

View File

@@ -102,17 +102,41 @@ jobs:
echo "Found $DIFF_SIZE bytes of relevant changes" echo "Found $DIFF_SIZE bytes of relevant changes"
echo "diff_size=$DIFF_SIZE" >> $GITHUB_OUTPUT echo "diff_size=$DIFF_SIZE" >> $GITHUB_OUTPUT
# Create the API request # Create prompt text
DIFF_CONTENT=$(cat filtered_diff.txt) PROMPT_TEXT="You are performing a code review. Please analyze this code diff and provide a thorough review that covers:
1. Potential conflicts with existing codebase
2. Code correctness and potential bugs
3. Security vulnerabilities or risks
4. Performance implications
5. Maintainability and readability issues
6. Adherence to best practices and coding standards
7. Suggestions for improvements
For each issue found:
- Explain the problem clearly
- Rate the severity (Critical/High/Medium/Low)
- Provide specific recommendations for fixes
- Include code examples where helpful
If no issues are found in a particular area, explicitly state that.
Here is the code diff to review:
\`\`\`
$(cat filtered_diff.txt)
\`\`\`"
# Create API request with proper string handling
REQUEST=$(jq -n \ REQUEST=$(jq -n \
--arg diff "$DIFF_CONTENT" \ --arg prompt "$PROMPT_TEXT" \
'{ '{
"model": "claude-3-sonnet-20240229", model: "claude-3-sonnet-20240229",
"max_tokens": 4096, max_tokens: 4096,
"temperature": 0.7, temperature: 0.7,
"messages": [{ messages: [{
"role": "user", role: "user",
"content": "You are performing a code review. Please analyze this code diff and provide a thorough review that covers:\n\n1. Potential conflicts with existing codebase\n2. Code correctness and potential bugs\n3. Security vulnerabilities or risks\n4. Performance implications\n5. Maintainability and readability issues\n6. Adherence to best practices and coding standards\n7. Suggestions for improvements\n\nFor each issue found:\n- Explain the problem clearly\n- Rate the severity (Critical/High/Medium/Low)\n- Provide specific recommendations for fixes\n- Include code examples where helpful\n\nIf no issues are found in a particular area, explicitly state that.\n\nHere is the code diff to review:\n\n```\n" + $diff + "\n```" content: $prompt
}] }]
}') }')