feat: gitea client
This commit is contained in:
34
internal/pierre/review.go
Normal file
34
internal/pierre/review.go
Normal file
@@ -0,0 +1,34 @@
|
||||
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 {
|
||||
return fmt.Errorf("error fetching diff: %w", err)
|
||||
}
|
||||
|
||||
// Run Logic
|
||||
comments, err := s.judgePR(ctx, diff)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error judging PR: %w", 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
|
||||
}
|
||||
Reference in New Issue
Block a user