Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 57be99b

Browse files
authored
refactor: provide summary to review stage, lower temperature to 0 (#6)
<!-- This is an auto-generated comment: release notes by chatgpt --> ### Summary by ChatGPT Refactor: This pull request refactors the code to add a "Summary Stage" before the "Review Stage". The "Summary Stage" summarizes all the files in the pull request and adds the summary as a comment. The "Review Stage" is now responsible only for reviewing the code changes. <!-- end of auto-generated comment: release notes by chatgpt --> <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/fluxninja/chatgpt-pr-reviewer/6) <!-- Reviewable:end -->
1 parent 3c15119 commit 57be99b

File tree

10 files changed

+261
-227
lines changed

10 files changed

+261
-227
lines changed

.github/workflows/chatgpt.yaml renamed to .github/workflows/chatgpt-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
2727
with:
2828
debug: true
29-
review_comment_lgtm: true
29+
review_comment_lgtm: false

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ChatGPT based PR reviewer and summarizer
22

3+
![AI](./docs/images/ai.png)
4+
35
## Overview
46

57
This [ChatGPT](https://platform.openai.com/docs/guides/chat) based GitHub Action provides a summary, release notes and review of pull requests. The prompts have been tuned for concise response. To prevent excessive notifications, this action can be configured to skip adding review comments when the changes look good for the most part.
@@ -173,7 +175,6 @@ Set `debug: true` in the workflow file to enable debug mode, which will show the
173175

174176
### Special Thanks
175177

176-
This GitHub Action is based on
178+
This GitHub Action is based on
177179
[ChatGPT Action](https://github.com/unsafecoerce/chatgpt-pr-reviewer)
178180
by [Tao He](https://github.com/sighingnow).
179-

action.yml

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ inputs:
1212
temperature:
1313
required: false
1414
description: 'Temperature for ChatGPT model'
15-
default: '0.1'
15+
default: '0.0'
16+
review_comment_lgtm:
17+
required: false
18+
description: 'Leave comments even if the patch is LGTM'
19+
default: 'false'
1620
path_filters:
1721
required: false
1822
description: |
@@ -22,6 +26,7 @@ inputs:
2226
- https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
2327
- https://github.com/isaacs/minimatch
2428
default: |
29+
!dist/**
2530
!**/*.pb.go
2631
!**/*.lock
2732
!**/*.yaml
@@ -51,63 +56,6 @@ inputs:
5156
description: |
5257
The URL of the chatgpt reverse proxy, see also https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy
5358
default: https://chat.duti.tech/api/conversation
54-
review_comment_lgtm:
55-
required: false
56-
description: 'Leave comments even if the patch is LGTM'
57-
default: false
58-
review_beginning:
59-
required: false
60-
description: 'The beginning prompt of a code review dialog'
61-
default: |
62-
$system_message
63-
64-
I will be providing you some files and entire diff to help you build
65-
context, in case the content is not too large. Then I will be sending you each patch
66-
from the diff for review.
67-
68-
I have a pull request with title "$title" and the description is as follows,
69-
70-
> $description.
71-
72-
Reply "OK" to confirm that you are ready for further instructions.
73-
review_file:
74-
required: false
75-
description: 'The prompt for each file'
76-
default: |
77-
Providing `$filename` content as context. Please use this context when reviewing patches.
78-
79-
```
80-
$file_content
81-
```
82-
review_file_diff:
83-
required: false
84-
description: 'The prompt for each file diff'
85-
default: |
86-
Providing entire diff for `$filename` as context. Please use this context when reviewing patches.
87-
88-
```diff
89-
$file_diff
90-
```
91-
review_patch_begin:
92-
required: false
93-
description: 'The prompt for each file diff'
94-
default: |
95-
Next, I will send you a series of patches, each of them consists of a diff snippet, and you
96-
need to do a brief code review for every patch, and tell me any bug risk or improvement
97-
suggestion. If the patch looks good and acceptable, please reply "LGTM!" with a short
98-
comment within 30 words.
99-
100-
Your responses will be recorded as review comments on the pull request. Markdown format is
101-
preferred for your responses. Reply "OK" to confirm.
102-
review_patch:
103-
required: false
104-
description: 'The prompt for each chunks/patches'
105-
default: |
106-
$filename
107-
108-
```diff
109-
$patch
110-
```
11159
summarize_beginning:
11260
required: false
11361
description: 'The prompt for the whole pull request'
@@ -166,6 +114,63 @@ inputs:
166114
e.g. "New Feature: An integrations page was added to the UI". Your response should be as
167115
concise as possible (50-100 words), without additional commentary as this response will be
168116
used as is in our release notes.
117+
review_beginning:
118+
required: false
119+
description: 'The beginning prompt of a code review dialog'
120+
default: |
121+
$system_message
122+
123+
I will be providing you some files and entire diff to help you build
124+
context, in case the content is not too large. Then I will be sending you each patch
125+
from the diff for review.
126+
127+
I have a pull request with title "$title" and the description is as follows,
128+
129+
> $description.
130+
131+
ChatGPT generated summary is as follows,
132+
133+
> $summary
134+
135+
Reply "OK" to confirm that you are ready for further instructions.
136+
review_file:
137+
required: false
138+
description: 'The prompt for each file'
139+
default: |
140+
Providing `$filename` content as context. Please use this context when reviewing patches.
141+
142+
```
143+
$file_content
144+
```
145+
review_file_diff:
146+
required: false
147+
description: 'The prompt for each file diff'
148+
default: |
149+
Providing entire diff for `$filename` as context. Please use this context when reviewing patches.
150+
151+
```diff
152+
$file_diff
153+
```
154+
review_patch_begin:
155+
required: false
156+
description: 'The prompt for each file diff'
157+
default: |
158+
Next, I will send you a series of patches, each of them consists of a diff snippet, and you
159+
need to do a brief code review for every patch, and tell me any bug risk or improvement
160+
suggestion. If the patch looks good and acceptable, please reply "LGTM!" with a short
161+
comment within 30 words.
162+
163+
Your responses will be recorded as review comments on the pull request. Markdown format is
164+
preferred for your responses. Reply "OK" to confirm.
165+
review_patch:
166+
required: false
167+
description: 'The prompt for each chunks/patches'
168+
default: |
169+
$filename
170+
171+
```diff
172+
$patch
173+
```
169174
runs:
170175
using: 'node16'
171176
main: 'dist/index.js'

dist/index.js

Lines changed: 85 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/images/ai.png

1.9 MB
Loading

0 commit comments

Comments
 (0)