diff --git a/.gitignore b/.gitignore index 572f1d6b..3056bb60 100644 --- a/.gitignore +++ b/.gitignore @@ -123,3 +123,11 @@ tags.lock .env .secrets bin/act +/.idea/.gitignore +/.idea/ai-pr-reviewer.iml +/.idea/codeStyles/codeStyleConfig.xml +/.idea/misc.xml +/.idea/modules.xml +/.idea/codeStyles/Project.xml +/.idea/inspectionProfiles/Project_Default.xml +/.idea/vcs.xml diff --git a/dist/index.js b/dist/index.js index a6f49664..b941650b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3898,7 +3898,7 @@ IMPORTANT: Entire response must be in the language with ISO code: ${options.lang /* harmony export */ "oi": () => (/* binding */ RAW_SUMMARY_START_TAG), /* harmony export */ "rV": () => (/* binding */ RAW_SUMMARY_END_TAG) /* harmony export */ }); -/* unused harmony exports COMMENT_GREETING, IN_PROGRESS_START_TAG, IN_PROGRESS_END_TAG, DESCRIPTION_START_TAG, DESCRIPTION_END_TAG, COMMIT_ID_START_TAG, COMMIT_ID_END_TAG */ +/* unused harmony exports IN_PROGRESS_START_TAG, IN_PROGRESS_END_TAG, DESCRIPTION_START_TAG, DESCRIPTION_END_TAG, COMMIT_ID_START_TAG, COMMIT_ID_END_TAG */ /* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2186); /* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _actions_github__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(5438); @@ -3911,7 +3911,6 @@ IMPORTANT: Entire response must be in the language with ISO code: ${options.lang // eslint-disable-next-line camelcase const context = _actions_github__WEBPACK_IMPORTED_MODULE_1__.context; const repo = context.repo; -const COMMENT_GREETING = `${(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)('bot_icon')} CodeRabbit`; const COMMENT_TAG = ''; const COMMENT_REPLY_TAG = ''; const SUMMARIZE_TAG = ''; @@ -3950,9 +3949,7 @@ class Commenter { if (!tag) { tag = COMMENT_TAG; } - const body = `${COMMENT_GREETING} - -${message} + const body = `${message} ${tag}`; if (mode === 'create') { @@ -4027,9 +4024,7 @@ ${tag}`; } reviewCommentsBuffer = []; async bufferReviewComment(path, startLine, endLine, message) { - message = `${COMMENT_GREETING} - -${message} + message = `${message} ${COMMENT_TAG}`; this.reviewCommentsBuffer.push({ @@ -4069,11 +4064,8 @@ ${COMMENT_TAG}`; (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.warning)(`Failed to list reviews: ${e}`); } } - async submitReview(pullNumber, commitId, statusMsg) { - const body = `${COMMENT_GREETING} - -${statusMsg} -`; + async submitReview(pullNumber, commitId) { + const body = ``; if (this.reviewCommentsBuffer.length === 0) { // Submit empty review with statusMsg (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.info)(`Submitting empty review for PR #${pullNumber}`); @@ -4177,9 +4169,7 @@ ${statusMsg} } } async reviewCommentReply(pullNumber, topLevelComment, message) { - const reply = `${COMMENT_GREETING} - -${message} + const reply = `${message} ${COMMENT_REPLY_TAG} `; @@ -4494,27 +4484,6 @@ ${chain} } return allCommits; } - // add in-progress status to the comment body - addInProgressStatus(commentBody, statusMsg) { - const start = commentBody.indexOf(IN_PROGRESS_START_TAG); - const end = commentBody.indexOf(IN_PROGRESS_END_TAG); - // add to the beginning of the comment body if the marker doesn't exist - // otherwise do nothing - if (start === -1 || end === -1) { - return `${IN_PROGRESS_START_TAG} - -Currently reviewing new changes in this PR... - -${statusMsg} - -${IN_PROGRESS_END_TAG} - ---- - -${commentBody}`; - } - return commentBody; - } // remove in-progress status from the comment body removeInProgressStatus(commentBody) { const start = commentBody.indexOf(IN_PROGRESS_START_TAG); @@ -7470,10 +7439,8 @@ ${filterIgnoredFiles.length > 0 ` : ''} `; - // update the existing comment with in progress status - const inProgressSummarizeCmt = commenter.addInProgressStatus(existingSummarizeCmtBody, statusMsg); // add in progress status to the summarize comment - await commenter.comment(`${inProgressSummarizeCmt}`, lib_commenter/* SUMMARIZE_TAG */.Rp, 'replace'); + // await commenter.comment(`${inProgressSummarizeCmt}`, SUMMARIZE_TAG, 'replace') const summariesFailed = []; const doSummary = async (filename, fileContent, fileDiff) => { (0,core.info)(`summarize: ${filename}`); @@ -7590,17 +7557,6 @@ ${lib_commenter/* RAW_SUMMARY_END_TAG */.rV} ${lib_commenter/* SHORT_SUMMARY_START_TAG */.O$} ${inputs.shortSummary} ${lib_commenter/* SHORT_SUMMARY_END_TAG */.Zb} - ---- - -
-Uplevel your code reviews with CodeRabbit Pro - -### 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. Moreover, CodeRabbit Pro is free for open source projects. - -
`; statusMsg += ` ${skippedFiles.length > 0 @@ -7805,10 +7761,11 @@ ${reviewsSkipped.length > 0 // add existing_comment_ids_block with latest head sha summarizeComment += `\n${commenter.addReviewedCommitId(existingCommitIdsBlock, context.payload.pull_request.head.sha)}`; // post the review - await commenter.submitReview(context.payload.pull_request.number, commits[commits.length - 1].sha, statusMsg); + await commenter.submitReview(context.payload.pull_request.number, commits[commits.length - 1].sha); } // post the final summary comment - await commenter.comment(`${summarizeComment}`, lib_commenter/* SUMMARIZE_TAG */.Rp, 'replace'); + // close summary to reduce comment noise + // await commenter.comment(`${summarizeComment}`, SUMMARIZE_TAG, 'replace') }; const splitPatch = (patch) => { if (patch == null) { diff --git a/src/commenter.ts b/src/commenter.ts index fc14e70f..9c109076 100644 --- a/src/commenter.ts +++ b/src/commenter.ts @@ -7,8 +7,6 @@ import {octokit} from './octokit' const context = github_context const repo = context.repo -export const COMMENT_GREETING = `${getInput('bot_icon')} CodeRabbit` - export const COMMENT_TAG = '' @@ -66,9 +64,7 @@ export class Commenter { tag = COMMENT_TAG } - const body = `${COMMENT_GREETING} - -${message} + const body = `${message} ${tag}` @@ -183,9 +179,7 @@ ${tag}` endLine: number, message: string ) { - message = `${COMMENT_GREETING} - -${message} + message = `${message} ${COMMENT_TAG}` this.reviewCommentsBuffer.push({ @@ -231,11 +225,8 @@ ${COMMENT_TAG}` } } - async submitReview(pullNumber: number, commitId: string, statusMsg: string) { - const body = `${COMMENT_GREETING} - -${statusMsg} -` + async submitReview(pullNumber: number, commitId: string) { + const body = `` if (this.reviewCommentsBuffer.length === 0) { // Submit empty review with statusMsg @@ -367,9 +358,7 @@ ${statusMsg} topLevelComment: any, message: string ) { - const reply = `${COMMENT_GREETING} - -${message} + const reply = `${message} ${COMMENT_REPLY_TAG} ` @@ -753,28 +742,6 @@ ${chain} return allCommits } - // add in-progress status to the comment body - addInProgressStatus(commentBody: string, statusMsg: string): string { - const start = commentBody.indexOf(IN_PROGRESS_START_TAG) - const end = commentBody.indexOf(IN_PROGRESS_END_TAG) - // add to the beginning of the comment body if the marker doesn't exist - // otherwise do nothing - if (start === -1 || end === -1) { - return `${IN_PROGRESS_START_TAG} - -Currently reviewing new changes in this PR... - -${statusMsg} - -${IN_PROGRESS_END_TAG} - ---- - -${commentBody}` - } - return commentBody - } - // remove in-progress status from the comment body removeInProgressStatus(commentBody: string): string { const start = commentBody.indexOf(IN_PROGRESS_START_TAG) diff --git a/src/review.ts b/src/review.ts index 5e7dd9db..3fb8f5db 100644 --- a/src/review.ts +++ b/src/review.ts @@ -294,15 +294,8 @@ ${ : '' } ` - - // update the existing comment with in progress status - const inProgressSummarizeCmt = commenter.addInProgressStatus( - existingSummarizeCmtBody, - statusMsg - ) - // add in progress status to the summarize comment - await commenter.comment(`${inProgressSummarizeCmt}`, SUMMARIZE_TAG, 'replace') + // await commenter.comment(`${inProgressSummarizeCmt}`, SUMMARIZE_TAG, 'replace') const summariesFailed: string[] = [] @@ -457,17 +450,6 @@ ${RAW_SUMMARY_END_TAG} ${SHORT_SUMMARY_START_TAG} ${inputs.shortSummary} ${SHORT_SUMMARY_END_TAG} - ---- - -
-Uplevel your code reviews with CodeRabbit Pro - -### 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. Moreover, CodeRabbit Pro is free for open source projects. - -
` statusMsg += ` @@ -745,13 +727,14 @@ ${ // post the review await commenter.submitReview( context.payload.pull_request.number, - commits[commits.length - 1].sha, - statusMsg + commits[commits.length - 1].sha ) } // post the final summary comment - await commenter.comment(`${summarizeComment}`, SUMMARIZE_TAG, 'replace') + + // close summary to reduce comment noise + // await commenter.comment(`${summarizeComment}`, SUMMARIZE_TAG, 'replace') } const splitPatch = (patch: string | null | undefined): string[] => {