Files
pierre-bot/internal/pierre/review.go
2026-02-12 21:44:10 +01:00

35 lines
804 B
Go

package pierre
import (
"context"
"fmt"
"log"
)
func (s *Service) MakeReview(ctx context.Context, organisation string, repo string, prID int) error {
// Fetch Diff using positional args from shared RepoArgs
diff, err := s.git.GetDiff(organisation, repo, prID)
if err != nil {
log.Fatalf("Error fetching diff: %v", err)
}
// Run Logic
comments, err := s.judgePR(context.Background(), diff)
if err != nil {
log.Fatalf("Error judging PR: %v", err)
}
fmt.Printf("Analysis complete. Found %d issues.\n---\n", len(comments))
for _, c := range comments {
fmt.Printf("File: %s\nLine: %d\nMessage: %s\n%s\n",
c.File, c.Line, c.Message, "---")
if err := s.git.AddComment(organisation, repo, prID, c); err != nil {
log.Printf("Failed to add comment: %v", err)
}
}
return nil
}