Skip to content

Commit 7a3d45b

Browse files
committed
Enhance code review workflow by adding empty diff check and improving Ollama readiness verification
1 parent 7d3909a commit 7a3d45b

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.github/workflows/code-review.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,18 @@ jobs:
2828
id: generate-diff
2929
run: |
3030
echo "Generating diff between origin/${{ github.base_ref }} and origin/${{ github.head_ref }}"
31-
git diff --unified=10 origin/${{ github.base_ref }}...origin/${{ github.head_ref }} > changes.diff
31+
git diff --unified=10 origin/${{ github.base_ref }}...origin/${{ github.head_ref }} > changes.diff
32+
33+
# Check if diff is empty
34+
if [ ! -s changes.diff ]; then
35+
echo "No changes detected"
36+
echo "NO_CHANGES=true" >> $GITHUB_ENV
37+
exit 0
38+
fi
39+
40+
# Limit diff size to avoid token limits (first 100 lines)
41+
head -100 changes.diff > limited_changes.diff
42+
mv limited_changes.diff changes.diff
3243
3344
- name: Sanitize Diff
3445
run: |
@@ -56,7 +67,18 @@ jobs:
5667
# Verify model is available via API
5768
echo "Verifying model availability via API..."
5869
curl -s http://localhost:11434/api/tags | jq '.'
59-
70+
71+
- name: Wait for Ollama to be ready
72+
run: |
73+
for i in {1..10}; do
74+
if curl -s http://localhost:11434/api/tags | jq '.'; then
75+
echo "Ollama is ready."
76+
break
77+
fi
78+
echo "Waiting for Ollama to be ready..."
79+
sleep 3
80+
done
81+
6082
- name: Prepare Prompt
6183
run: |
6284
DIFF=$(cat sanitized_diff.txt)

0 commit comments

Comments
 (0)