oonyeje-portfolio/.gitea/workflows/llm_pipeline_actions.yaml
oonyeje 6d39e12493
Some checks failed
Ollama Review / review-code-with-llm (pull_request) Successful in 54s
continuous-integration/drone/push Build is failing
- move cli to diferent step
2025-03-07 15:36:45 -05:00

34 lines
1.2 KiB
YAML

name: 'Ollama Review'
on:
pull_request:
types: [opened, synchronize] # PR open시 자동 코드 리뷰 요청
jobs:
review-code-with-llm:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v43
- name: Setup Gitea CLI
run: |
curl -o gitea https://dl.gitea.io/gitea-cli/1.5.0/linux-amd64/gitea
chmod +x gitea
./gitea --version
- name: Review code
env:
GITEA_TOKEN: ${{ secrets.token }}
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
review=$(curl -s https://ollama.bsidesolutions.net/api/generate -d '{"model": "${{ inputs.model }}", "prompt": "Review the following file:\n\n```\n$(cat $file)\n```", "stream": false}' | jq -r '.response')
comment="Ollama Code Review for \`$file\`:\n\n$review"
echo "$comment" >> ollama_review.txt
done
./gitea pr comment ${{ gitea.event.pull_request.number }} --body "$(cat ollama_review.txt)"
shell: bash