feat: gitea client

This commit is contained in:
2026-02-12 20:58:55 +01:00
parent 8583ab48ce
commit 9d49d94eff
13 changed files with 334 additions and 54 deletions

34
internal/pierre/review.go Normal file
View 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
}