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

Commit 89e3721

Browse files
authored
update prompt (#138)
1 parent ebbd42e commit 89e3721

File tree

3 files changed

+28
-32
lines changed

3 files changed

+28
-32
lines changed

action.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -192,46 +192,50 @@ inputs:
192192
Your review must consist of comments in the below format
193193
with a separator between review comments. The format consists of
194194
line number range and review comment applicable for that line
195-
number range. Any other commentary outside of this format will be ignored
195+
number range. You can make multiple comments for each hunk.
196+
Any other commentary outside of this format will be ignored
196197
and will not be read by the parser. It's important that line number
197198
ranges for each review must be within line number range of new_hunks.
198199
Don't echo back the code provided to you as the
199200
line number range is sufficient to map your comment to the relevant code
200-
section in GitHub. You can make multiple comments for each hunk and
201-
suggest new code that can replace code at those line number ranges.
201+
section in GitHub.
202202
203-
<start_line_number_in_new_hunk>-<end_line_number_in_new_hunk>:
204-
<your review>
203+
Markdown format is preferred for text. Fenced code blocks should be
204+
used for complete code suggestions that replace code at those
205+
exact line number ranges -
206+
207+
<start_line_number>-<end_line_number>:
208+
<review markdown>
209+
```suggestion
210+
<replacement of code between start_line_number and end_line_number>
211+
```
212+
---
213+
<start_line_number>-<end_line_number>:
214+
<review markdown>
205215
---
206216
...
207217
208-
Example:
218+
Examples -
219+
209220
1-5:
210221
LGTM!
211222
---
212223
6-6:
213-
LGTM!
224+
```suggestion
225+
print "Hello!"
226+
```
214227
---
215228
216-
Reflect on the provided code at least 3 times and identify any
229+
Reflect on the provided code thoroughly and identify substantive
217230
bug risks or provide improvement suggestions in these changes.
218-
You will point out potential issues such as security, logic errors,
231+
You will point out issues such as security, logic errors,
219232
syntax errors, out of bound errors, data races, consistency,
220233
complexity, error handling, typos, grammar, maintainability,
221234
performance, and so on.
222235
223236
If there are no issues or suggestions and the change is acceptable
224237
as-is, you must include the word `LGTM!` and make a short review comment.
225238
226-
Markdown format is preferred for text. Fenced code blocks should be
227-
used for code suggestions that replace exact lines ranges -
228-
229-
start-end:
230-
<review text in markdown>
231-
```suggestion
232-
<replacement code between start and end lines>
233-
```
234-
---
235239
comment:
236240
required: false
237241
description: 'Prompt for comment'

dist/index.js

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/review.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as core from '@actions/core'
22
import * as github from '@actions/github'
33
import {Octokit} from '@octokit/action'
4-
import {ChatGPTError} from 'chatgpt'
54
import pLimit from 'p-limit'
65
import {Bot} from './bot.js'
76
import {Commenter, COMMENT_REPLY_TAG, SUMMARIZE_TAG} from './commenter.js'
@@ -415,12 +414,10 @@ ${
415414
} else {
416415
comment_chain = ''
417416
}
418-
} catch (e: unknown) {
419-
if (e instanceof ChatGPTError) {
420-
core.warning(
421-
`Failed to get comments: ${e}, skipping. backtrace: ${e.stack}`
422-
)
423-
}
417+
} catch (e: any) {
418+
core.warning(
419+
`Failed to get comments: ${e}, skipping. backtrace: ${e.stack}`
420+
)
424421
}
425422
// try packing comment_chain into this request
426423
const comment_chain_tokens = tokenizer.get_token_count(comment_chain)
@@ -483,7 +480,7 @@ ${comment_chain}
483480
review.end_line,
484481
`${review.comment}`
485482
)
486-
} catch (e: unknown) {
483+
} catch (e: any) {
487484
reviews_failed.push(`${filename} comment failed (${e})`)
488485
}
489486
}

0 commit comments

Comments
 (0)