-
-
Notifications
You must be signed in to change notification settings - Fork 2
39 lines (34 loc) · 1.13 KB
/
chatgptreview.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
name: Analyze PR files and add descriptions
on:
pull_request:
types: [opened, synchronize]
jobs:
analyze-pr-files:
runs-on: ubuntu-latest
steps:
- name: Checkout PR files
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Send files to ChatGPT
uses: openai/action-chatbot@v1
with:
api-key: ${{ secrets.OPENAI_API_KEY }}
model: text-davinci-002
prompt: "Please analyze the following files and provide brief descriptions:"
context: |
${{ toJson(github.event.pull_request.head.repo.files) }}
- name: Add descriptions to PR
uses: actions/github-script@v3
with:
script: |
const prDescription = 'PR file descriptions:\n' + process.env.CHATGPT_RESPONSE
const prNumber = context.payload.pull_request.number
const octokit = new GitHub()
await octokit.pulls.update({
...context.repo,
pull_request_number: prNumber,
body: prDescription
})
env:
CHATGPT_RESPONSE: ${{ steps.chatbot.outputs.response }}