Skip to content

Commit fa8e6d7

Browse files
authored
Invite bot (coderabbitai#45)
<!-- This is an auto-generated comment: release notes by openai --> ### Summary by OpenAI New Feature: The bot can now reply to top-level comments on a conversation chain on a code review diff, if the comment starts with "@openai". This functionality has been added to `src/review-comment.ts`, along with error handling and warning messages. <!-- end of auto-generated comment: release notes by openai -->
1 parent ea23e7b commit fa8e6d7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dist/index.js

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

src/review-comment.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const token = core.getInput('token')
1111
const octokit = new Octokit({auth: `token ${token}`})
1212
const context = github.context
1313
const repo = context.repo
14+
const BOT_INVITE = '@openai'
1415

1516
export const handleReviewComment = async (bot: Bot) => {
1617
const commenter: Commenter = new Commenter()
@@ -50,7 +51,11 @@ export const handleReviewComment = async (bot: Bot) => {
5051
comment
5152
)
5253
// check whether this chain contains replies from the bot
53-
if (chain.includes(COMMENT_TAG) || chain.includes(COMMENT_REPLY_TAG)) {
54+
if (
55+
chain.includes(COMMENT_TAG) ||
56+
chain.includes(COMMENT_REPLY_TAG) ||
57+
comment.body.startsWith(BOT_INVITE)
58+
) {
5459
const prompt = `I would like you to reply to the new comment made on a conversation chain on a code review diff.
5560
5661
Diff:

0 commit comments

Comments
 (0)