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:
25
.github/workflows/claude-review.yml
vendored
25
.github/workflows/claude-review.yml
vendored
@@ -89,6 +89,13 @@ jobs:
|
|||||||
DIFF_SIZE=$(wc -c < filtered_changes.diff)
|
DIFF_SIZE=$(wc -c < filtered_changes.diff)
|
||||||
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
|
||||||
|
|
||||||
|
# Store the diff content for the next step
|
||||||
|
DIFF_CONTENT=$(cat filtered_changes.diff)
|
||||||
|
echo "diff_content<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo "$DIFF_CONTENT" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
echo "Preview of changes:"
|
echo "Preview of changes:"
|
||||||
head -n 5 filtered_changes.diff
|
head -n 5 filtered_changes.diff
|
||||||
else
|
else
|
||||||
@@ -106,7 +113,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||||
run: |
|
run: |
|
||||||
DIFF_CONTENT=$(cat filtered_changes.diff)
|
# Get the diff content from the previous step
|
||||||
|
DIFF_CONTENT="${{ steps.changed-files.outputs.diff_content }}"
|
||||||
|
|
||||||
# Create the request body using jq
|
# Create the request body using jq
|
||||||
REQUEST_BODY=$(jq -n \
|
REQUEST_BODY=$(jq -n \
|
||||||
@@ -155,13 +163,9 @@ jobs:
|
|||||||
|
|
||||||
if echo "$RESPONSE" | jq -e '.content[0].text' > /dev/null; then
|
if echo "$RESPONSE" | jq -e '.content[0].text' > /dev/null; then
|
||||||
REVIEW=$(echo "$RESPONSE" | jq -r '.content[0].text')
|
REVIEW=$(echo "$RESPONSE" | jq -r '.content[0].text')
|
||||||
|
echo "review<<EOF" >> $GITHUB_OUTPUT
|
||||||
# Escape the review content for GitHub Actions
|
echo "$REVIEW" >> $GITHUB_OUTPUT
|
||||||
REVIEW="${REVIEW//'%'/'%25'}"
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
REVIEW="${REVIEW//$'\n'/'%0A'}"
|
|
||||||
REVIEW="${REVIEW//$'\r'/'%0D'}"
|
|
||||||
|
|
||||||
echo "review=$REVIEW" >> $GITHUB_OUTPUT
|
|
||||||
else
|
else
|
||||||
echo "Error in Claude API response: $RESPONSE"
|
echo "Error in Claude API response: $RESPONSE"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -173,12 +177,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
|
const { owner, repo } = context.repo;
|
||||||
const review = `${{ steps.analysis.outputs.review }}`;
|
const review = `${{ steps.analysis.outputs.review }}`;
|
||||||
const prNumber = ${{ steps.pr-number.outputs.number }};
|
const prNumber = ${{ steps.pr-number.outputs.number }};
|
||||||
|
|
||||||
await github.rest.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: owner,
|
||||||
repo: context.repo.name,
|
repo: repo,
|
||||||
issue_number: prNumber,
|
issue_number: prNumber,
|
||||||
body: `# Claude Code Review\n\n${review}`
|
body: `# Claude Code Review\n\n${review}`
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user