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

improve demarcation of inputs #160

Merged
merged 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ inputs:
You are `@openai` (aka `github-actions[bot]`), a language model
trained by OpenAI. Your purpose is to act as a highly experienced
software engineer and provide a thorough review of the code hunks
and suggest code snippets to improve key areas such as -
and suggest code snippets to improve key areas such as:
- Logic
- Security
- Performance
Expand All @@ -110,20 +110,20 @@ inputs:
required: false
description: 'The prompt for file'
default: |
GitHub pull request title -
GitHub pull request title:
`$title`

Description -
Description:
```
$description
```

Content of file `$filename` -
Content of file `$filename`:
```
$file_content
```

Diff -
Diff:
```diff
$file_diff
```
Expand All @@ -133,14 +133,13 @@ inputs:
required: false
description: 'The prompt for final summarization response'
default: |
Here is the summary of changes you have generated for each file -
Here is the summary of changes you have generated for each file:
```
$summary
```

Provide your final response in the `markdown` format with
the following content -
- Thank the user for letting you participate in the code review.
the following content:
- High-level summary (comment on the overall change instead of
specific files within 80 words)
- Table of files and their summaries. You can group files with
Expand Down Expand Up @@ -169,25 +168,25 @@ inputs:
required: false
description: 'The prompt for each file'
default: |
GitHub pull request title -
GitHub pull request title:
`$title`

Description -
Description:
```
$description
```

OpenAI generated summary of overall changes -
OpenAI generated summary of overall changes:
```
$summary
```

Content of file `$filename` for context -
Content of file `$filename` for context:
```
$file_content
```

Changes for review -
Changes for review:
$patches
comment:
required: false
Expand All @@ -197,38 +196,38 @@ inputs:
diff hunk on file `$filename`. I would like you to follow
the instructions in that comment.

Pull request title -
Pull request title:
`$title`

Description-
Description:
```
$description
```

OpenAI generated summary -
OpenAI generated summary:
```
$summary
```

Content of file -
Content of file:
```
$file_content
```

Entire diff -
Entire diff:
```diff
$file_diff
```

Diff being commented on -
Diff being commented on:
```diff
$diff
```

The format of a comment in the chain is -
The format of a comment in the chain is:
`user: comment`

Comment chain (including the new comment) -
Comment chain (including the new comment):
```
$comment_chain
```
Expand All @@ -243,7 +242,7 @@ inputs:
In your reply, please make sure to begin the reply by tagging the user
with "@user".

The comment/request that you need to directly reply to -
The comment/request that you need to directly reply to:
```
$comment
```
Expand Down
16 changes: 16 additions & 0 deletions src/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,14 @@ export const codeReview = async (
}
const hunks_str = `
---new_hunk_for_review---
\`\`\`
${hunks.new_hunk}
\`\`\`

---old_hunk_for_context---
\`\`\`
${hunks.old_hunk}
\`\`\`
`
patches.push([
patch_lines.new_hunk.start_line,
Expand Down Expand Up @@ -368,11 +373,20 @@ ${
ins.patches += `
Format for changes -
---new_hunk_for_review---
\`\`\`
<new content annotated with line numbers>
\`\`\`

---old_hunk_for_context---
\`\`\`
<old content>
\`\`\`

---comment_chains_for_context---
\`\`\`
<comment chains>
\`\`\`

---end_change_section---
...

Expand Down Expand Up @@ -507,7 +521,9 @@ ${patch}
if (comment_chain !== '') {
ins.patches += `
---comment_chains_for_review---
\`\`\`
${comment_chain}
\`\`\`
`
}

Expand Down