feat: add CreateIssue to Forge interface with Gitea implementation

This commit is contained in:
sam committed 2026-07-23 19:12:12 +10:00
1 parent 1bf4f7668f
commit 423eb78fef
7 files changed
+22 -74

No files matched your search

+3
View File
@@ -58,6 +58,9 @@ type Forge interface {
// CloseIssue closes an issue with an optional final comment.
CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error
// CreateIssue opens a new issue and returns its number.
CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error)
// React adds an emoji reaction to an issue.
React(ctx context.Context, owner, repo string, number int, reaction string) error
+9
View File
@@ -171,6 +171,15 @@ func (c *GiteaClient) CloseIssue(ctx context.Context, owner, repo string, number
return err
}
// CreateIssue opens a new issue and returns its number.
func (c *GiteaClient) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) {
iss, _, err := c.cli.CreateIssue(owner, repo, gitea.CreateIssueOption{Title: title, Body: body})
if err != nil {
return 0, err
}
return int(iss.Index), nil
}
// React adds an emoji reaction to an issue.
func (c *GiteaClient) React(ctx context.Context, owner, repo string, number int, reaction string) error {
_, _, err := c.cli.PostIssueReaction(owner, repo, int64(number), reaction)
+6 -1
View File
@@ -200,10 +200,15 @@ func (c *GitHubClient) CloseIssue(ctx context.Context, owner, repo string, numbe
}
}
_, _, err := c.gh.Issues.Edit(ctx, owner, repo, number,
&github.IssueRequest{State: new("closed")})
&github.IssueRequest{State: github.String("closed")})
return err
}
// CreateIssue opens a new issue and returns its number (stub — Gitea is primary).
func (c *GitHubClient) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) {
return 0, fmt.Errorf("GitHub CreateIssue not yet implemented")
}
// State labels mirror the task lifecycle onto the forge so archie's
// status is visible at a glance. SQLite remains the source of truth;
// labels are the human-facing projection — and removing the parked