23
23
fetch-depth : 0
24
24
25
25
# Fetches the base branch (e.g., main) from the remote repository
26
- - name : Fetch base branch
26
+ - name : Fetch Base Branch
27
27
run : |
28
28
git fetch origin ${{ github.base_ref }}
29
29
@@ -35,12 +35,10 @@ jobs:
35
35
run : |
36
36
echo "Generating diff between ${{ github.base_ref }} and ${{ github.head_ref }}"
37
37
DIFF=$(git diff origin/${{ github.base_ref }}...${{ github.head_ref }})
38
- echo "diff_output<<EOF" >> $GITHUB_ENV
39
- echo "$DIFF" >> $GITHUB_ENV
40
- echo "EOF" >> $GITHUB_ENV
38
+ echo "diff_output=$DIFF" >> $GITHUB_ENV
41
39
42
40
# Step 4: Output the diff (optional)
43
- - name : Print diff
41
+ - name : Print Diff
44
42
run : |
45
43
echo "Diff Output:"
46
44
echo "${{ env.diff_output }}"
50
48
run : |
51
49
echo "${{ env.diff_output }}" > changes.diff
52
50
53
- # - name: Install Ollama CLI
54
- # run: |
55
- # curl -fsSL https://ollama.com/install.sh | sh
56
- # ollama --version
51
+ - name : Install Ollama
52
+ run : |
53
+ curl -fsSL https://ollama.com/install.sh | sh
54
+ ollama --version
55
+
56
+ - name : Pull Model
57
+ run : |
58
+ ollama pull ${{ env.MODEL_NAME }} || { echo "Failed to pull model"; exit 1; }
59
+ ollama list
60
+
61
+ - name : Code Review
62
+ run : |
63
+ prompt=$(echo "Please review the following code changes and provide feedback:\n\n${{ env.diff_output }}\n\nFeedback:" | sed 's/"/\\"/g')
64
+ RAW_RESPONSE=$(curl -s -X POST http://localhost:11434/api/generate \
65
+ -d '{
66
+ "model": "'"${{ env.MODEL_NAME }}"'",
67
+ "prompt": "'"${prompt}"'",
68
+ "temperature": 0.5,
69
+ "stream": false
70
+ }' || { echo "API call failed"; exit 1; })
71
+ echo "RAW RESPONSE:\n$RAW_RESPONSE"
0 commit comments