Skip to content

Commit 6b67fce

Browse files
authored
Merge pull request #2 from LiteObject/feature/refactor_code
Add installation step for Ollama CLI in code review workflow
2 parents 50fc81f + ba9bc24 commit 6b67fce

File tree

1 file changed

+44
-7
lines changed

1 file changed

+44
-7
lines changed

.github/workflows/code-review.yml

+44-7
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,53 @@ jobs:
1515
MODEL_NAME: "llama3.2:latest"
1616
steps:
1717
# Checkout the repository code
18-
- name: Checkout repository
18+
- name: Checkout Repository
1919
uses: actions/checkout@v4
2020
with:
21+
# Checks out the code from the pull request's head branch.
2122
ref: ${{ github.event.pull_request.head.ref }}
23+
fetch-depth: 0
24+
25+
# Fetches the base branch (e.g., main) from the remote repository
26+
- name: Fetch base branch
27+
run: |
28+
git fetch origin ${{ github.base_ref }}
29+
30+
# - name: Fetch Pull Request Branch
31+
# run: git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-branch
32+
33+
- name: Generate Diff
34+
id: generate-diff
35+
run: |
36+
echo "Generating diff between ${{ github.base_ref }} and ${{ github.head_ref }}"
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
2241
23-
- name: Fetch pull request branch
24-
run: git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-branch
42+
- name: Check Diff Size
43+
id: check_diff_size
44+
run: |
45+
set -e
46+
DIFF_SIZE=$(wc -c < change.diff)
47+
echo "diff_size=$DIFF_SIZE" >> $GITHUB_OUTPUT
48+
if (( DIFF_SIZE > 1000000 )); then
49+
echo "Diff is too large, skipping review."
50+
exit 0
51+
fi
52+
53+
# Step 4: Output the diff (optional)
54+
- name: Print diff
55+
run: |
56+
echo "Diff Output:"
57+
echo "${{ env.diff_output }}"
2558
26-
- name: Generate diff
59+
# Step 5: Save the diff to a file (optional)
60+
- name: Save diff to file
2761
run: |
28-
git diff ${{ github.event.pull_request.base.sha }} pr-branch > change.diff
29-
echo "Diff generated successfully."
30-
echo "Diff content:" $(cat change.diff)
62+
echo "${{ env.diff_output }}" > changes.diff
63+
64+
# - name: Install Ollama CLI
65+
# run: |
66+
# curl -fsSL https://ollama.com/install.sh | sh
67+
# ollama --version

0 commit comments

Comments
 (0)