Skip to content

Commit 13b5628

Browse files
authored
Merge pull request #5 from LiteObject/feature/refactor_code
Feature/refactor code
2 parents 8397794 + 08e4ccb commit 13b5628

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

.github/workflows/code-review.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
fetch-depth: 0
2424

2525
# Fetches the base branch (e.g., main) from the remote repository
26-
- name: Fetch base branch
26+
- name: Fetch Base Branch
2727
run: |
2828
git fetch origin ${{ github.base_ref }}
2929
@@ -35,12 +35,10 @@ jobs:
3535
run: |
3636
echo "Generating diff between ${{ github.base_ref }} and ${{ github.head_ref }}"
3737
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
4139
4240
# Step 4: Output the diff (optional)
43-
- name: Print diff
41+
- name: Print Diff
4442
run: |
4543
echo "Diff Output:"
4644
echo "${{ env.diff_output }}"
@@ -50,7 +48,24 @@ jobs:
5048
run: |
5149
echo "${{ env.diff_output }}" > changes.diff
5250
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

Comments
 (0)