forge/github: implement CreateIssue to un-stub the method
Replaces the 'not yet implemented' stub with a real call to go-github's Issues.Create, mapping title, body, and labels.
This commit is contained in:
1 parent
367637d174
commit
a56f95d967
1 file changed
+11
-2
@@ -209,9 +209,18 @@ func (c *GitHubClient) LinkBranch(ctx context.Context, owner, repo string, issue
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateIssue opens a new issue and returns its number (stub -- Gitea is primary).
|
||||
// CreateIssue opens a new issue and returns its number.
|
||||
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")
|
||||
req := &github.IssueRequest{
|
||||
Title: &title,
|
||||
Body: &body,
|
||||
Labels: &labels,
|
||||
}
|
||||
iss, _, err := c.gh.Issues.Create(ctx, owner, repo, req)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("create issue %s/%s: %w", owner, repo, err)
|
||||
}
|
||||
return iss.GetNumber(), nil
|
||||
}
|
||||
|
||||
// State labels mirror the task lifecycle onto the forge so archie's
|
||||
|
||||
Reference in new issue
Block a user