-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
79 lines (74 loc) · 2.49 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: 'Corivai - Code Review AI Assistant'
description: 'AI-powered code review with custom instructions'
author: Muhammad Utsman
branding:
icon: "activity"
color: "red"
inputs:
reviewer-api-key:
description: 'Provider API Key'
required: true
github-token:
description: 'GitHub Token'
required: true
model-name:
description: 'Gemini model name'
required: true
default: ''
openai-url:
description: 'Endpoint for OpenAI library compatibility'
required: false
default: 'https://api.openai.com/v1'
custom-instructions:
description: 'Additional review instructions (Markdown supported)'
required: false
default: ''
max-diff-size:
description: 'Max size of diff for analysts'
required: false
default: '100000'
runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download Action Code and Requirements
run: |
export VERSION=5
curl -L https://github.com/utsmannn/corivai/archive/refs/tags/v${VERSION}.zip -o action_code.zip
unzip action_code.zip
cp -R corivai-${VERSION}/corivai .
cp corivai-${VERSION}/requirements.txt .
shell: bash
- name: Install dependencies
run: |
pip install -r requirements.txt
shell: bash
- name: Execute review
if: github.event_name == 'pull_request'
env:
API_KEY: ${{ inputs.reviewer-api-key }}
GITHUB_TOKEN: ${{ inputs.github-token }}
INPUT_OPENAI-URL: ${{ inputs.openai-url }}
INPUT_MODEL-NAME: ${{ inputs.model-name }}
INPUT_CUSTOM-INSTRUCTIONS: ${{ inputs.custom-instructions }}
INPUT_MAX_DIFF_SIZE: ${{ inputs.max-diff-size }}
run: python -m corivai.main
shell: bash
- name: Process Review Comments
if: github.event_name == 'pull_request_review_comment'
env:
API_KEY: ${{ inputs.reviewer-api-key }}
INPUT_OPENAI-URL: ${{ inputs.openai-url }}
INPUT_MODEL-NAME: ${{ inputs.model-name }}
GITHUB_TOKEN: ${{ inputs.github-token }}
COMMENT_BODY: ${{ github.event.comment.body }}
COMMENT_ID: ${{ github.event.comment.id }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
REVIEW_THREAD_ID: ${{ github.event.comment.pull_request_review_id }}
USER_LOGIN: ${{ github.event.comment.user.login }}
run: python -m corivai.github_comment_processor
shell: bash