Skip to content

Commit 73655a1

Browse files
committed
Refactor Code Review step to use jq for payload preparation in API call
1 parent 36de555 commit 73655a1

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/code-review.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,30 @@ jobs:
7878
shell: /usr/bin/bash -e {0}
7979

8080
# Step 9: Perform code review using Ollama
81+
# - name: Code Review
82+
# run: |
83+
# RAW_RESPONSE=$(curl -s -X POST http://localhost:11434/api/generate \
84+
# -d '{
85+
# "model": "'"${{ env.MODEL_NAME }}"'",
86+
# "prompt": "'"${{ env.prompt }}"'",
87+
# "temperature": 0.5,
88+
# "stream": false
89+
# }' || { echo "API call failed"; exit 1; })
90+
# echo "RAW RESPONSE:\n$RAW_RESPONSE"
91+
8192
- name: Code Review
8293
run: |
94+
PAYLOAD=$(jq -n \
95+
--arg model "$MODEL_NAME" \
96+
--arg prompt "$prompt" \
97+
'{
98+
model: $model,
99+
prompt: $prompt,
100+
temperature: 0.5,
101+
stream: false
102+
}')
83103
RAW_RESPONSE=$(curl -s -X POST http://localhost:11434/api/generate \
84-
-d '{
85-
"model": "'"${{ env.MODEL_NAME }}"'",
86-
"prompt": "'"${{ env.prompt }}"'",
87-
"temperature": 0.5,
88-
"stream": false
89-
}' || { echo "API call failed"; exit 1; })
104+
-d "$PAYLOAD" || { echo "API call failed"; exit 1; })
90105
echo "RAW RESPONSE:\n$RAW_RESPONSE"
91106
92107
# Step 9: Optionally save the response as an artifact

0 commit comments

Comments
 (0)