Skip to content

Commit

Permalink
git-diff-action has JSON output
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
  • Loading branch information
bacongobbler committed Apr 3, 2024
1 parent 15335c5 commit bb67484
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
with:
fetch-depth: 0

- uses: GrantBirki/git-diff-action@v2.6.0
- name: Get the PR diff
uses: GrantBirki/git-diff-action@v2.6.0
id: git-diff

- name: Review code
Expand All @@ -23,9 +24,7 @@ jobs:
# Get the diff
diff=$(cat ${{ steps.git-diff.outputs.raw-diff-path }})
escaped_diff=$(echo $diff | jq -sRr @json)
echo $escaped_diff
echo $diff
# Send to OpenAI for review
response=$(curl -X POST https://api.openai.com/v1/chat/completions \
Expand All @@ -40,7 +39,7 @@ jobs:
},
{
"role": "user",
"content": $escaped_diff
"content": $diff
}
]
}')
Expand Down

0 comments on commit bb67484

Please sign in to comment.