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

Commit

Permalink
refactor: provide summary to review stage, lower temperature to 0 (#6)
Browse files Browse the repository at this point in the history
<!-- 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 -->
  • Loading branch information
harjotgill committed Mar 11, 2023
1 parent 3c15119 commit 57be99b
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
with:
debug: true
review_comment_lgtm: true
review_comment_lgtm: false
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ChatGPT based PR reviewer and summarizer

![AI](./docs/images/ai.png)

## Overview

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.
Expand Down Expand Up @@ -173,7 +175,6 @@ Set `debug: true` in the workflow file to enable debug mode, which will show the

### Special Thanks

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

121 changes: 63 additions & 58 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ inputs:
temperature:
required: false
description: 'Temperature for ChatGPT model'
default: '0.1'
default: '0.0'
review_comment_lgtm:
required: false
description: 'Leave comments even if the patch is LGTM'
default: 'false'
path_filters:
required: false
description: |
Expand All @@ -22,6 +26,7 @@ inputs:
- https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
- https://github.com/isaacs/minimatch
default: |
!dist/**
!**/*.pb.go
!**/*.lock
!**/*.yaml
Expand Down Expand Up @@ -51,63 +56,6 @@ inputs:
description: |
The URL of the chatgpt reverse proxy, see also https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy
default: https://chat.duti.tech/api/conversation
review_comment_lgtm:
required: false
description: 'Leave comments even if the patch is LGTM'
default: false
review_beginning:
required: false
description: 'The beginning prompt of a code review dialog'
default: |
$system_message
I will be providing you some files and entire diff to help you build
context, in case the content is not too large. Then I will be sending you each patch
from the diff for review.
I have a pull request with title "$title" and the description is as follows,
> $description.
Reply "OK" to confirm that you are ready for further instructions.
review_file:
required: false
description: 'The prompt for each file'
default: |
Providing `$filename` content as context. Please use this context when reviewing patches.
```
$file_content
```
review_file_diff:
required: false
description: 'The prompt for each file diff'
default: |
Providing entire diff for `$filename` as context. Please use this context when reviewing patches.
```diff
$file_diff
```
review_patch_begin:
required: false
description: 'The prompt for each file diff'
default: |
Next, I will send you a series of patches, each of them consists of a diff snippet, and you
need to do a brief code review for every patch, and tell me any bug risk or improvement
suggestion. If the patch looks good and acceptable, please reply "LGTM!" with a short
comment within 30 words.
Your responses will be recorded as review comments on the pull request. Markdown format is
preferred for your responses. Reply "OK" to confirm.
review_patch:
required: false
description: 'The prompt for each chunks/patches'
default: |
$filename
```diff
$patch
```
summarize_beginning:
required: false
description: 'The prompt for the whole pull request'
Expand Down Expand Up @@ -166,6 +114,63 @@ inputs:
e.g. "New Feature: An integrations page was added to the UI". Your response should be as
concise as possible (50-100 words), without additional commentary as this response will be
used as is in our release notes.
review_beginning:
required: false
description: 'The beginning prompt of a code review dialog'
default: |
$system_message
I will be providing you some files and entire diff to help you build
context, in case the content is not too large. Then I will be sending you each patch
from the diff for review.
I have a pull request with title "$title" and the description is as follows,
> $description.
ChatGPT generated summary is as follows,
> $summary
Reply "OK" to confirm that you are ready for further instructions.
review_file:
required: false
description: 'The prompt for each file'
default: |
Providing `$filename` content as context. Please use this context when reviewing patches.
```
$file_content
```
review_file_diff:
required: false
description: 'The prompt for each file diff'
default: |
Providing entire diff for `$filename` as context. Please use this context when reviewing patches.
```diff
$file_diff
```
review_patch_begin:
required: false
description: 'The prompt for each file diff'
default: |
Next, I will send you a series of patches, each of them consists of a diff snippet, and you
need to do a brief code review for every patch, and tell me any bug risk or improvement
suggestion. If the patch looks good and acceptable, please reply "LGTM!" with a short
comment within 30 words.
Your responses will be recorded as review comments on the pull request. Markdown format is
preferred for your responses. Reply "OK" to confirm.
review_patch:
required: false
description: 'The prompt for each chunks/patches'
default: |
$filename
```diff
$patch
```
runs:
using: 'node16'
main: 'dist/index.js'
155 changes: 85 additions & 70 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added docs/images/ai.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 57be99b

Please sign in to comment.