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

Commit 4661569

Browse files
authored
add code suggestions (#122)
1 parent 3f04676 commit 4661569

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

action.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ inputs:
9191
trained by OpenAI. You have been designed to act as a highly
9292
experienced software engineer today. Your main task is to review
9393
code and documentation, provide suggestions, and write new code
94-
or documentation when requested.
94+
or documentation when requested. Please ensure that your responses
95+
are focused on assisting with code and documentation concerns,
96+
following best practices and industry standards.
9597
summarize_file_diff:
9698
required: false
9799
description: 'The prompt for the whole pull request'
@@ -165,15 +167,15 @@ inputs:
165167
$file_content
166168
```
167169
168-
Below is the format for patches. `---`
169-
separator is used between patches.
170+
Format for changes and review comments on line ranges.
171+
`---` separator is used.
170172
171173
<start_line-end_line>:
172174
```diff
173175
<diff_hunk>
174176
```
175177
```text
176-
<review comments on patch, if any>
178+
<review comments on diff_hunk, if any>
177179
```
178180
---
179181
...
@@ -183,7 +185,7 @@ inputs:
183185
displaying added, removed, and unchanged lines with
184186
"+" or "-" prefixes and surrounding context lines.
185187
186-
Patches for review are below -
188+
Diff hunks for review are below -
187189
188190
$patches
189191
@@ -198,29 +200,28 @@ inputs:
198200
---
199201
<start_line-end_line>:
200202
<explain why suggestion makes sense>
201-
```diff
202-
<suggested diff>
203+
```suggestion
204+
<replacement code that from start_line, with necessary changes>
203205
```
204206
---
205-
<start_line-end_line>:
206-
<explain why new code should be included>
207-
```<language>
208-
<new code>
209-
```
210207
...
211208
212-
You can comment or suggest code changes for the patches and the
209+
You can comment or suggest code changes for the diff hunks and the
213210
line ranges provided by you should map to the exact line ranges
214-
provided in the patches.
211+
provided in the diff hunks. When suggesting a code change, it is
212+
important that you provide the new code that replaces the entire
213+
line range in the diff hunk from the beginning, including the context
214+
lines in the diff hunk. Partial replacements are not acceptable, as
215+
they will not work with GitHub's code suggestion feature.
215216
216217
Reflect on the provided code at least 3 times to identify any
217-
bug risks or provide improvement suggestions in these patches.
218+
bug risks or provide improvement suggestions in these diff hunks.
218219
You will point out potential issues such as security, logic errors,
219220
syntax errors, out of bound errors, data races, consistency,
220221
complexity, error handling, typos, grammar, maintainability,
221222
performance, and so on.
222223
223-
If there are no issues or suggestions and the patch is acceptable
224+
If there are no issues or suggestions and the diff hunk is acceptable
224225
as-is, please include "LGTM!" (exact word) in your short
225226
review comment.
226227
@@ -229,7 +230,7 @@ inputs:
229230
required: false
230231
description: 'Prompt for comment'
231232
default: |
232-
A comment was made on a review for a diff patch on file
233+
A comment was made on a review for a diff hunk on file
233234
`$filename`. I would like you to follow the instructions
234235
in that comment.
235236
@@ -297,10 +298,11 @@ inputs:
297298
and provide as fenced code block in markdown.
298299
299300
Any code change suggestion to the diff hunk must be enclosed in fenced code
300-
blocks with the suggestion identifier -
301+
blocks with the suggestion identifier and the change must completely
302+
replace the diff hunk provided to you from the beginning -
301303
<your comment to the user>
302-
```diff
303-
<suggested diff>
304+
```suggestion
305+
<change>
304306
```
305307
runs:
306308
using: 'node16'

dist/index.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)