mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 02:41:06 -05:00
Update claude-review.yml
This commit is contained in:
53
.github/workflows/claude-review.yml
vendored
53
.github/workflows/claude-review.yml
vendored
@@ -91,22 +91,44 @@ 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
|
||||||
|
|
||||||
# Prepare the diff content for the API request
|
# Prepare prompt and diff content
|
||||||
DIFF_CONTENT=$(cat diff_filtered.txt)
|
PROMPT="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 diff_filtered.txt)
|
||||||
|
\`\`\`"
|
||||||
|
|
||||||
# Create the API request using a heredoc
|
# Create the API request using jq to properly escape the content
|
||||||
REQUEST=$(cat << EOF
|
echo "Creating API request..."
|
||||||
{
|
REQUEST=$(jq -n \
|
||||||
"model": "claude-3-sonnet-20240229",
|
--arg prompt "$PROMPT" \
|
||||||
"max_tokens": 4096,
|
'{
|
||||||
"temperature": 0.7,
|
"model": "claude-3-sonnet-20240229",
|
||||||
"messages": [{
|
"max_tokens": 4096,
|
||||||
"role": "user",
|
"temperature": 0.7,
|
||||||
"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_CONTENT\n\`\`\`"
|
"messages": [{
|
||||||
}]
|
"role": "user",
|
||||||
}
|
"content": $prompt
|
||||||
EOF
|
}]
|
||||||
)
|
}')
|
||||||
|
|
||||||
# Make the API request
|
# Make the API request
|
||||||
echo "Sending request to Claude API..."
|
echo "Sending request to Claude API..."
|
||||||
@@ -124,6 +146,7 @@ jobs:
|
|||||||
echo 'EOF' >> $GITHUB_OUTPUT
|
echo 'EOF' >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "Error in Claude API response: $RESPONSE"
|
echo "Error in Claude API response: $RESPONSE"
|
||||||
|
echo "Request was: $REQUEST"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user