Skip to content

Fix errors in GitHub Actions Workflow script #1904

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,21 @@ jobs:
if [ -f original_files_temp.json ]; then
jq -s '.[0] * .[1]' diff.json original_files_temp.json > combined.json
mv combined.json diff.json
fi

- name: Display Processed Diff (Debug)
run: cat diff.json

- name: Analyze with OpenAI
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
MODELNAME: ${{ vars.MODELNAME }}
run: |
DIFF_CONTENT=$(jq -r '.diff' diff.json)
ORIGINAL_FILES=$(jq -r '."original files"' diff.json)
PROMPT="Please review the following code changes for any obvious quality or security issues. Provide a brief report in markdown format:\n\nDIFF:\n${DIFF_CONTENT}\n\nORIGINAL FILES:\n${ORIGINAL_FILES}"
jq -n --arg prompt "$PROMPT" '{
"model": "gpt-4",
jq -n --arg model "$MODELNAME" --arg prompt "$PROMPT" '{
"model": "\($model)",
"messages": [
{ "role": "system", "content": "You are a code reviewer." },
{ "role": "user", "content": $prompt }
Expand Down Expand Up @@ -257,4 +259,4 @@ Commit this workflow to your repository, then open a new PR. The workflow will r

![pr_quality_and_security_check.png](../../images/pr_quality_and_security_check.png)

![workflow_check.png](../../images/workflow_check.png)
![workflow_check.png](../../images/workflow_check.png)