feat: Gitea IssueTracker client + inject into brain server (#52, capture 49c) #58
@@ -63,7 +63,9 @@ type IssueRef struct {
|
|||||||
// scopes to owner "mathias"; the port deliberately omits owner.
|
// scopes to owner "mathias"; the port deliberately omits owner.
|
||||||
type IssueTracker interface {
|
type IssueTracker interface {
|
||||||
CreateIssue(ctx context.Context, repo, title, body string) (IssueRef, error)
|
CreateIssue(ctx context.Context, repo, title, body string) (IssueRef, error)
|
||||||
CloseIssue(ctx context.Context, repo string, number int) (IssueRef, error)
|
// CloseIssue closes an issue, optionally posting a closing comment
|
||||||
|
// first (empty comment ⇒ close only).
|
||||||
|
CloseIssue(ctx context.Context, repo string, number int, comment string) (IssueRef, error)
|
||||||
CommentIssue(ctx context.Context, repo string, number int, body string) (IssueRef, error)
|
CommentIssue(ctx context.Context, repo string, number int, body string) (IssueRef, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ func (s *Service) persistTicket(ctx context.Context, tk Ticket) (TicketResult, e
|
|||||||
case "create":
|
case "create":
|
||||||
ref, err = s.issues.CreateIssue(ctx, tk.Repo, tk.Title, tk.Body)
|
ref, err = s.issues.CreateIssue(ctx, tk.Repo, tk.Title, tk.Body)
|
||||||
case "close":
|
case "close":
|
||||||
ref, err = s.issues.CloseIssue(ctx, tk.Repo, tk.Number)
|
ref, err = s.issues.CloseIssue(ctx, tk.Repo, tk.Number, tk.Body)
|
||||||
case "comment":
|
case "comment":
|
||||||
ref, err = s.issues.CommentIssue(ctx, tk.Repo, tk.Number, tk.Body)
|
ref, err = s.issues.CommentIssue(ctx, tk.Repo, tk.Number, tk.Body)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func (f *fakeTracker) CreateIssue(_ context.Context, repo, title, _ string) (Iss
|
|||||||
return IssueRef{Repo: repo, Number: 100 + len(f.created), URL: "https://git/" + repo + "/issues/x"}, nil
|
return IssueRef{Repo: repo, Number: 100 + len(f.created), URL: "https://git/" + repo + "/issues/x"}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeTracker) CloseIssue(_ context.Context, repo string, number int) (IssueRef, error) {
|
func (f *fakeTracker) CloseIssue(_ context.Context, repo string, number int, _ string) (IssueRef, error) {
|
||||||
if f.err != nil {
|
if f.err != nil {
|
||||||
return IssueRef{}, f.err
|
return IssueRef{}, f.err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user