forked from yu-iskw/gpt-code-review-action
-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.yml
107 lines (101 loc) · 3.28 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Code Review by Gemini AI"
description: "Automatically create a comment about differences in a pull request by Gemini AI"
author: "rubensflinco"
inputs:
gemini_api_key:
description: "The Gemini AI API token to use for the action"
required: true
github_token:
description: "The GitHub token to use for the action"
required: true
github_repository:
description: "The GitHub repository to use for the action"
required: true
default: "${{ github.repository }}"
github_pull_request_number:
description: "The GitHub pull request number to use for the action"
required: true
default: "${{ github.event.pull_request.number }}"
git_commit_hash:
description: "The GitHub commit hash to use for the action"
required: true
default: "${{ github.event.pull_request.head.sha }}"
model:
description: "GPT model"
required: true
default: "text-davinci-003"
extra_prompt:
description: "Extra prompt for GPT"
required: false
default: ""
temperature:
description: "Temperature for GPT"
required: false
default: "0.7"
max_tokens:
description: "Max tokens for GPT"
required: false
default: "256"
top_p:
description: "Top p for GPT"
required: false
default: "1"
frequency_penalty:
description: "Frequency penalty for GPT"
required: false
default: "0.0"
presence_penalty:
description: "Presence penalty for GPT"
required: false
default: "0.0"
pull_request_diff:
description: "Pull request diff"
required: true
pull_request_chunk_size:
description: "Pull request chunk size"
required: false
default: "3500"
log_level:
description: "Log level"
required: false
default: "INFO"
outputs:
entire_prompt_body:
description: "Entire prompt body"
value: ${{ steps.gpt.outputs.entire_prompt_body }}
review_result:
description: "Review result"
value: ${{ steps.gpt.outputs.review_result }}
branding:
icon: "code"
color: "blue"
runs:
using: docker
image: Dockerfile
env:
GEMINI_API_KEY: ${{ inputs.gemini_api_key }}
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_REPOSITORY: ${{ inputs.github_repository }}
GITHUB_PULL_REQUEST_NUMBER: ${{ inputs.github_pull_request_number }}
GIT_COMMIT_HASH: ${{ inputs.git_commit_hash }}
args:
- "--model=${{ inputs.model }}"
- "--extra-prompt=${{ inputs.extra_prompt }}"
- "--temperature=${{ inputs.temperature }}"
- "--max-tokens=${{ inputs.max_tokens }}"
- "--top-p=${{ inputs.top_p }}"
- "--frequency-penalty=${{ inputs.frequency_penalty }}"
- "--presence-penalty=${{ inputs.presence_penalty }}"
- "--diff-chunk-size=${{ inputs.pull_request_chunk_size }}"
- "--diff=${{ inputs.pull_request_diff }}"