oonyeje-portfolio/.gitea/workflows/llm_pipeline_actions.yaml
oonyeje a30d873527
Some checks failed
Ollama Review / review-code-with-llm (pull_request) Successful in 56s
continuous-integration/drone/push Build is failing
- fix tea install
2025-03-07 16:16:54 -05:00

47 lines
1.6 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: |
LATEST_VERSION=$(curl -s https://dl.gitea.com/tea/ | \
grep -oP '(?<=href="/tea/)[^/"]*' | \
grep -E '^[0-9]+(\.[0-9]+){1,2}$' | \
sort -V | \
tail -n 1)
curl -L https://dl.gitea.com/tea/${LATEST_VERSION}/tea-${LATEST_VERSION}-linux-amd64 -o /usr/local/bin/tea
chmod +x /usr/local/bin/tea
tea --version
tea --version
tea login add --name gitea --url ${{ gitea.server_url }} --token ${{ secrets.token }}
tea login default gitea
- 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
tea pr comment ${{ gitea.event.pull_request.number }} --body "$(cat ollama_review.txt)"
shell: bash