Merge pull request #466 from samcharles93/fix/github-create-issue
forge/github: implement CreateIssue to un-stub the method
This commit is contained in:
commit
4e0eade43f
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