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

Commit

Permalink
provide additional context for replies (#47)
Browse files Browse the repository at this point in the history
<!-- 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 -->
  • Loading branch information
harjotgill authored Mar 18, 2023
1 parent 1dfd2f0 commit 1a37167
Show file tree
Hide file tree
Showing 8 changed files with 723 additions and 425 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ jobs:
See also: [./action.yml](./action.yml)
### Conversation with OpenAI
You can reply to a review comment made by this action and get a response based
on the diff context. Additionally, you can invite the bot to a conversation by
mentioning it in the beginning of the comment with `@openai`.

Example:

> @openai Can you please review this block of code?

#### Environment variables

- `GITHUB_TOKEN`: This should already be available to the GitHub Action
Expand Down
77 changes: 77 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,83 @@ inputs:
```diff
$patch
```
comment_beginning:
required: false
description: 'Prompt for comment'
default: |
$system_message
A comment was made on a review for a diff patch on file
`$filename`. You will be replying directly to that. If possible, I
will provide you the file and the entire diff to help
provide overall context.
For context, the pull request has the title "$title" and the following
description:
```
$description
```
The OpenAI-generated summary is as follows:
```
$summary
```
Reply "OK" to confirm.
comment_file:
required: false
description: 'Prompt for file'
default: |
Here is the content of `$filename` for context.
```
$file_content
```
comment_file_diff:
required: false
description: 'Prompt for file diff'
default: |
Here is the entire diff for `$filename` for context.
```diff
$file_diff
```
comment:
required: false
description: 'Prompt for comment'
default: |
I would like you to reply to the new comment made on
a conversation chain on a code review diff.
Diff being commented on:
```diff
$diff
```
The format of the conversation chain is:
`user: comment`
Conversation chain (including the new comment):
```
$comment_chain
```
Please reply directly to the new comment in the conversation
chain without extra prose as that reply will be posted as-is.
In your reply, please make sure to begin the reply by
tagging the user with "@user".
The comment that you need to directly reply to:
```
$comment
```
runs:
using: 'node16'
main: 'dist/index.js'
Loading

0 comments on commit 1a37167

Please sign in to comment.