forked from iejMac/GPTReview
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
59 lines (59 loc) · 1.75 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
name: 'GPTReview'
description: 'Let AI review your code'
inputs:
OPENAI_API_KEY:
description: 'OpenAI API Key'
required: true
GITHUB_TOKEN:
description: 'pass secrets.GITHUB_TOKEN'
required: true
GIT_COMMIT_HASH:
description: 'pass github.event.pull_request.head.sha'
required: true
PR_TITLE:
description: 'pass github.event.pull_request.title'
required: true
PR_BODY:
description: 'pass github.event.pull_request.body'
required: true
REPOSITORY_NAME:
description: 'pass github.repository'
required: true
PR_NUMBER:
description: 'pass github.event.pull_request.number'
required: true
DIFF:
description: 'what has changed between PRs'
required: true
runs:
using: "composite"
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install
shell: bash
run: |
sudo apt-get update
python3 -m venv .env
source .env/bin/activate
python -m pip install -U pip
pip install openai
pip install requests
- name: Fetch review logic
uses: wei/wget@v1
with:
args: -O review.py https://raw.githubusercontent.com/samjhill/GPTReview/main/review.py
- name: Review PR and make comment
shell: bash
run: |
source .env/bin/activate
python review.py
env:
LINK: "https://github.com/${{ inputs.REPOSITORY_NAME }}/pull/${{ inputs.PR_NUMBER }}"
OPENAI_API_KEY: ${{ inputs.OPENAI_API_KEY }}
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
GIT_COMMIT_HASH: ${{ inputs.GIT_COMMIT_HASH }}
PR_TITLE: ${{ inputs.PR_TITLE }}
PR_BODY: ${{ inputs.PR_BODY }}