-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (38 loc) · 1.4 KB
/
code-review.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
name: 'Code Review GPT'
# Comentários para descrição e autor
# Descrição: Reviews the staged files with a GPT model from OpenAI
# Autor: Skynance
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
issues: write
pull-requests: write
jobs:
code-review:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Isso assegura que todo o histórico do repositório é buscado
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: Install Code Review GPT
working-directory: ./infra/code-review-gpt
run: npm install code-review-gpt
- name: List Modified Files (Debugging Step)
run: |
git fetch origin ${{ github.base_ref }}
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
- name: Run Code Review GPT
working-directory: ./infra/code-review-gpt
run: npx code-review-gpt review --ci=github --model=$MODEL --base-sha=$BASE_SHA --head-sha=$HEAD_SHA
env:
MODEL: gpt-3.5-turbo
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}