From 516a0728038a4363e7eb4ed6ee2cc23660a2a0a3 Mon Sep 17 00:00:00 2001 From: Harjot Gill Date: Thu, 31 Aug 2023 18:08:35 -0700 Subject: [PATCH] fix issue with multiple release notes (#452) ### Summary by CodeRabbit ``` - Refactor: Updated `DESCRIPTION_START_TAG` constant to be a string and optimized the `removeContentWithinTags` function in `src/commenter.ts`. - Documentation: Updated product name from "Professional Version of CodeRabbit" to "CodeRabbit Pro" in README.md and src/review.ts. - New Feature: Announced that CodeRabbit Pro is now free for open source projects, as reflected in src/review.ts. ``` --- README.md | 10 +++---- dist/index.js | 76 ++++++++++++------------------------------------ src/commenter.ts | 8 ++--- src/review.ts | 2 +- 4 files changed, 29 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index f9693cdc..5e1c2759 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,13 @@ FAQs, you can refer to the sections below. - [Contribute](#contribute) - [FAQs](#faqs) -## Professional Version of CodeRabbit +## CodeRabbit Pro The professional version of `openai-pr-reviewer` project is now available at -[coderabbit.ai](http://coderabbit.ai). Building upon our open-source foundation, -CodeRabbit offers premium features including enhanced context and superior noise -reduction, dedicated support, and our ongoing commitment to improve code -reviews. +[coderabbit.ai](http://coderabbit.ai). Building upon our open source foundation, +CodeRabbit Pro offers premium features including enhanced context and superior +noise reduction, dedicated support, and our ongoing commitment to improve code +reviews. Moreover, CodeRabbit Pro is free for open source projects. ## Install instructions diff --git a/dist/index.js b/dist/index.js index 37c8e4e1..a6f80920 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3917,8 +3917,7 @@ const COMMENT_REPLY_TAG = ''; const IN_PROGRESS_START_TAG = ''; const IN_PROGRESS_END_TAG = ''; -const DESCRIPTION_START_TAG = ` -`; +const DESCRIPTION_START_TAG = ''; const DESCRIPTION_END_TAG = ''; const RAW_SUMMARY_START_TAG = ` ' -export const DESCRIPTION_START_TAG = ` -` +export const DESCRIPTION_START_TAG = + '' export const DESCRIPTION_END_TAG = '' @@ -93,7 +93,7 @@ ${tag}` removeContentWithinTags(content: string, startTag: string, endTag: string) { const start = content.indexOf(startTag) - const end = content.indexOf(endTag) + const end = content.lastIndexOf(endTag) if (start >= 0 && end >= 0) { return content.slice(0, start) + content.slice(end + endTag.length) } @@ -155,7 +155,7 @@ ${tag}` DESCRIPTION_START_TAG, DESCRIPTION_END_TAG ) - const newDescription = `${description}${DESCRIPTION_START_TAG}\n${messageClean}\n${DESCRIPTION_END_TAG}` + const newDescription = `${description}\n${DESCRIPTION_START_TAG}\n${messageClean}\n${DESCRIPTION_END_TAG}` await octokit.pulls.update({ owner: repo.owner, repo: repo.repo, diff --git a/src/review.ts b/src/review.ts index 69112de4..5e7dd9db 100644 --- a/src/review.ts +++ b/src/review.ts @@ -465,7 +465,7 @@ ${SHORT_SUMMARY_END_TAG} ### CodeRabbit Pro -If you like this project, please support us by purchasing the [Pro version](https://coderabbit.ai). The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. +If you like this project, please support us by purchasing the [Pro version](https://coderabbit.ai). The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. `