- add manual steps to code review using ollama
This commit is contained in:
parent
325fbff1e6
commit
333d87c62f
@ -4,10 +4,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize] # PR open시 자동 코드 리뷰 요청
|
types: [opened, synchronize] # PR open시 자동 코드 리뷰 요청
|
||||||
|
|
||||||
# permissions:
|
|
||||||
# contents: read # 콘텐츠 접근 권한 (PR 변경 사항 읽기)
|
|
||||||
# pull-requests: write # PR comment 작성 권한
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-action:
|
test-action:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -15,22 +11,19 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Container Action
|
- name: Get changed files
|
||||||
uses: ljy2855/llm_code_reviewer@v1
|
id: changed-files
|
||||||
with:
|
uses: tj-actions/changed-files@v43
|
||||||
# fixed field
|
|
||||||
github_token: ${{ secrets.TOKEN }}
|
|
||||||
github_owner: ${{ github.repository_owner }}
|
|
||||||
github_repository: ${{ github.repository }}
|
|
||||||
pr_number: ${{ github.event.pull_request.number }}
|
|
||||||
pr_title: ${{ github.event.pull_request.title }}
|
|
||||||
pr_body: ${{ github.event.pull_request.body }}
|
|
||||||
|
|
||||||
# you might fill
|
- name: Review code
|
||||||
ollama_api_url: ${{ secrets.OLLAMA_API_URL }}
|
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)"
|
||||||
# optional field
|
shell: bash
|
||||||
ollama_model: 'qwen2.5-coder:14b'
|
|
||||||
prompt_type: 'GENERAL_REVIEW'
|
|
||||||
prompt_language: 'EN'
|
|
||||||
Loading…
x
Reference in New Issue
Block a user