Zack Saadioui
8/27/2024
1
2
bash
curl -fsSL https://ollama.com/install.sh | sh
1
.github/workflows
1
ollama_review.yml
1
pull_request
1
2
3
4
5
6
7
8
yaml
name: Ollama PR Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
1
2
3
4
5
6
7
yaml
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run Ollama Review
run: |
ollama run llama3.1 "Evaluate this code: $(cat path_to_your_file)"
1
path_to_your_file
1 2 3 4
- name: Analyze Changes run: | diff=$(git diff HEAD^ HEAD) ollama run llama3.1 "Please review the following changes: $diff"
1 2 3 4 5 6 7 8 9
- name: Post Comments on PR env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | response=$(ollama run llama3.1 "Here’s my review of the changes:") curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/<USERNAME>/<REPO>/issues/$(echo $GITHUB_REF | cut -d '/' -f 3)/comments \ -d "{\"body\": \"$response\"}"
1
<USERNAME>
1
<REPO>
Copyright © Arsturn 2024