Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Create ollama.yml

Create ollama.yml #13

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Ollama
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
pull_request:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Install Ollama
run: |
curl -fsSL https://ollama.com/install.sh | bash
shell: bash
- name: Start Ollama Service
run: |
nohup ollama &>/dev/null &
sleep 10 # Wait for the service to start
shell: bash
- name: Verify Ollama Service
run: |
if ! curl -s http://127.0.0.1:11434/api/status; then
echo "Ollama service is not running"
exit 1
fi
shell: bash
- name: Ollame pull
run: ollama pull codegemma
shell: bash
- name: Get modified files
id: get-modified-files
uses: tj-actions/changed-files@v43
- name: Review modified files
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
for file in ${{ steps.get-modified-files.outputs.all_changed_files }}; do
file_content=$(cat $file)
echo "Review $file with content \r\n $file_content"
modified_file_review=$(curl -s http://127.0.0.1:11434/api/generate -d '{"model": "codegemma", "prompt": "Review the following file:\n\n```\$file_content\n```", "stream": false}' | jq -r '.response')
gh pr comment ${{ github.event.pull_request.number }} --body "Ollama Code Review for \`$file\`:\r\n\r\n$modified_file_review"
done
shell: bash