mirror of
				https://github.com/freeedcom/ai-codereviewer.git
				synced 2025-10-30 21:50:53 +00:00 
			
		
		
		
	Added more logging and validation. [review]
This commit is contained in:
		
					parent
					
						
							
								4677946e97
							
						
					
				
			
			
				commit
				
					
						1565f8f40e
					
				
			
		
					 3 changed files with 27 additions and 7 deletions
				
			
		
							
								
								
									
										15
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							|  | @ -468,11 +468,16 @@ ${chunk.changes | |||
|        */ | ||||
|       function createReviewComment(owner, repo, pull_number, comments) { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|           const validComments = comments.filter((comment) => comment.line > 0); | ||||
|           if (validComments.length === 0) { | ||||
|             console.log("No valid comments to post."); | ||||
|             return; | ||||
|           } | ||||
|           yield octokit.pulls.createReview({ | ||||
|             owner, | ||||
|             repo, | ||||
|             pull_number, | ||||
|             comments, | ||||
|             comments: validComments, | ||||
|             event: "COMMENT", | ||||
|           }); | ||||
|         }); | ||||
|  | @ -535,8 +540,6 @@ ${chunk.changes | |||
|             ) | ||||
|           ); | ||||
|           const eventName = process.env.GITHUB_EVENT_NAME; | ||||
|           console.log("GitHub event name:", eventName); | ||||
|           console.log("GitHub event data:", eventData); | ||||
|           const prDetails = yield getPrDetails(eventName, eventData); | ||||
|           if (!prDetails) { | ||||
|             console.log( | ||||
|  | @ -582,6 +585,12 @@ ${chunk.changes | |||
|           const filteredDiff = filterDiffs(parsedDiff); | ||||
|           const comments = yield analyzeCode(filteredDiff, prDetails); | ||||
|           if (comments.length > 0) { | ||||
|             // Additional logging and validation before creating the review
 | ||||
|             comments.forEach((comment) => { | ||||
|               console.log( | ||||
|                 `Comment to be posted: ${comment.body} at ${comment.path}:${comment.line}` | ||||
|               ); | ||||
|             }); | ||||
|             yield createReviewComment( | ||||
|               prDetails.owner, | ||||
|               prDetails.repo, | ||||
|  |  | |||
							
								
								
									
										2
									
								
								dist/index.js.map
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js.map
									
										
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue