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

Commit beea59e

Browse files
authored
improve demarcation of inputs (#160)
1 parent c0b845f commit beea59e

File tree

2 files changed

+37
-22
lines changed

2 files changed

+37
-22
lines changed

action.yml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ inputs:
9090
You are `@openai` (aka `github-actions[bot]`), a language model
9191
trained by OpenAI. Your purpose is to act as a highly experienced
9292
software engineer and provide a thorough review of the code hunks
93-
and suggest code snippets to improve key areas such as -
93+
and suggest code snippets to improve key areas such as:
9494
- Logic
9595
- Security
9696
- Performance
@@ -110,20 +110,20 @@ inputs:
110110
required: false
111111
description: 'The prompt for file'
112112
default: |
113-
GitHub pull request title -
113+
GitHub pull request title:
114114
`$title`
115115
116-
Description -
116+
Description:
117117
```
118118
$description
119119
```
120120
121-
Content of file `$filename` -
121+
Content of file `$filename`:
122122
```
123123
$file_content
124124
```
125125
126-
Diff -
126+
Diff:
127127
```diff
128128
$file_diff
129129
```
@@ -133,14 +133,13 @@ inputs:
133133
required: false
134134
description: 'The prompt for final summarization response'
135135
default: |
136-
Here is the summary of changes you have generated for each file -
136+
Here is the summary of changes you have generated for each file:
137137
```
138138
$summary
139139
```
140140
141141
Provide your final response in the `markdown` format with
142-
the following content -
143-
- Thank the user for letting you participate in the code review.
142+
the following content:
144143
- High-level summary (comment on the overall change instead of
145144
specific files within 80 words)
146145
- Table of files and their summaries. You can group files with
@@ -169,25 +168,25 @@ inputs:
169168
required: false
170169
description: 'The prompt for each file'
171170
default: |
172-
GitHub pull request title -
171+
GitHub pull request title:
173172
`$title`
174173
175-
Description -
174+
Description:
176175
```
177176
$description
178177
```
179178
180-
OpenAI generated summary of overall changes -
179+
OpenAI generated summary of overall changes:
181180
```
182181
$summary
183182
```
184183
185-
Content of file `$filename` for context -
184+
Content of file `$filename` for context:
186185
```
187186
$file_content
188187
```
189188
190-
Changes for review -
189+
Changes for review:
191190
$patches
192191
comment:
193192
required: false
@@ -197,38 +196,38 @@ inputs:
197196
diff hunk on file `$filename`. I would like you to follow
198197
the instructions in that comment.
199198
200-
Pull request title -
199+
Pull request title:
201200
`$title`
202201
203-
Description-
202+
Description:
204203
```
205204
$description
206205
```
207206
208-
OpenAI generated summary -
207+
OpenAI generated summary:
209208
```
210209
$summary
211210
```
212211
213-
Content of file -
212+
Content of file:
214213
```
215214
$file_content
216215
```
217216
218-
Entire diff -
217+
Entire diff:
219218
```diff
220219
$file_diff
221220
```
222221
223-
Diff being commented on -
222+
Diff being commented on:
224223
```diff
225224
$diff
226225
```
227226
228-
The format of a comment in the chain is -
227+
The format of a comment in the chain is:
229228
`user: comment`
230229
231-
Comment chain (including the new comment) -
230+
Comment chain (including the new comment):
232231
```
233232
$comment_chain
234233
```
@@ -243,7 +242,7 @@ inputs:
243242
In your reply, please make sure to begin the reply by tagging the user
244243
with "@user".
245244
246-
The comment/request that you need to directly reply to -
245+
The comment/request that you need to directly reply to:
247246
```
248247
$comment
249248
```

src/review.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,14 @@ export const codeReview = async (
132132
}
133133
const hunks_str = `
134134
---new_hunk_for_review---
135+
\`\`\`
135136
${hunks.new_hunk}
137+
\`\`\`
138+
136139
---old_hunk_for_context---
140+
\`\`\`
137141
${hunks.old_hunk}
142+
\`\`\`
138143
`
139144
patches.push([
140145
patch_lines.new_hunk.start_line,
@@ -368,11 +373,20 @@ ${
368373
ins.patches += `
369374
Format for changes -
370375
---new_hunk_for_review---
376+
\`\`\`
371377
<new content annotated with line numbers>
378+
\`\`\`
379+
372380
---old_hunk_for_context---
381+
\`\`\`
373382
<old content>
383+
\`\`\`
384+
374385
---comment_chains_for_context---
386+
\`\`\`
375387
<comment chains>
388+
\`\`\`
389+
376390
---end_change_section---
377391
...
378392
@@ -507,7 +521,9 @@ ${patch}
507521
if (comment_chain !== '') {
508522
ins.patches += `
509523
---comment_chains_for_review---
524+
\`\`\`
510525
${comment_chain}
526+
\`\`\`
511527
`
512528
}
513529

0 commit comments

Comments
 (0)