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

Commit 1a37167

Browse files
authored
provide additional context for replies (#47)
<!-- This is an auto-generated comment: release notes by openai --> ### Summary by OpenAI New Feature: This pull request adds support for summarizing PR, file content, and diff in generated comments. It also includes comment handling inputs, updated handleReviewComment function to include prompts, and render functions for comments. Additionally, a section on how to converse with OpenAI using the action was added to the README.md file. <!-- end of auto-generated comment: release notes by openai -->
1 parent 1dfd2f0 commit 1a37167

File tree

8 files changed

+723
-425
lines changed

8 files changed

+723
-425
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ jobs:
6969
7070
See also: [./action.yml](./action.yml)
7171
72+
### Conversation with OpenAI
73+
74+
You can reply to a review comment made by this action and get a response based
75+
on the diff context. Additionally, you can invite the bot to a conversation by
76+
mentioning it in the beginning of the comment with `@openai`.
77+
78+
Example:
79+
80+
> @openai Can you please review this block of code?
81+
7282
#### Environment variables
7383

7484
- `GITHUB_TOKEN`: This should already be available to the GitHub Action

action.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,83 @@ inputs:
193193
```diff
194194
$patch
195195
```
196+
comment_beginning:
197+
required: false
198+
description: 'Prompt for comment'
199+
default: |
200+
$system_message
201+
202+
A comment was made on a review for a diff patch on file
203+
`$filename`. You will be replying directly to that. If possible, I
204+
will provide you the file and the entire diff to help
205+
provide overall context.
206+
207+
For context, the pull request has the title "$title" and the following
208+
description:
209+
210+
```
211+
$description
212+
```
213+
214+
The OpenAI-generated summary is as follows:
215+
216+
```
217+
$summary
218+
```
219+
220+
Reply "OK" to confirm.
221+
comment_file:
222+
required: false
223+
description: 'Prompt for file'
224+
default: |
225+
Here is the content of `$filename` for context.
226+
227+
```
228+
$file_content
229+
```
230+
comment_file_diff:
231+
required: false
232+
description: 'Prompt for file diff'
233+
default: |
234+
Here is the entire diff for `$filename` for context.
235+
236+
```diff
237+
$file_diff
238+
```
239+
comment:
240+
required: false
241+
description: 'Prompt for comment'
242+
default: |
243+
I would like you to reply to the new comment made on
244+
a conversation chain on a code review diff.
245+
246+
Diff being commented on:
247+
248+
```diff
249+
$diff
250+
```
251+
252+
The format of the conversation chain is:
253+
`user: comment`
254+
255+
Conversation chain (including the new comment):
256+
257+
```
258+
$comment_chain
259+
```
260+
261+
Please reply directly to the new comment in the conversation
262+
chain without extra prose as that reply will be posted as-is.
263+
264+
In your reply, please make sure to begin the reply by
265+
tagging the user with "@user".
266+
267+
The comment that you need to directly reply to:
268+
269+
```
270+
$comment
271+
```
272+
196273
runs:
197274
using: 'node16'
198275
main: 'dist/index.js'

0 commit comments

Comments
 (0)