feat(forge): add CreateIssue to the forge SDK, gitea and github plugins
publish / publish (push) Successful in 1m57s
publish / publish (push) Successful in 1m57s
Mirrors archie-core's proto/forge/v1 change: the SDK Forge interface and server dispatch gain CreateIssue; gitea resolves label names to IDs (creating missing labels) and github passes label names through.
This commit is contained in:
6 files changed
+475
-261
No files matched your search
@@ -416,6 +416,19 @@ func (c *GitHubClient) selfLogin(ctx context.Context) (string, error) {
|
||||
return c.login, nil
|
||||
}
|
||||
|
||||
// CreateIssue opens an issue with title, body and optional labels.
|
||||
func (c *GitHubClient) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) {
|
||||
req := &github.IssueRequest{Title: new(title), Body: new(body)}
|
||||
if len(labels) > 0 {
|
||||
req.Labels = &labels
|
||||
}
|
||||
issue, _, err := c.gh.Issues.Create(ctx, owner, repo, req)
|
||||
if err != nil {
|
||||
return 0, apiError(fmt.Sprintf("create issue in %s/%s", owner, repo), err)
|
||||
}
|
||||
return issue.GetNumber(), nil
|
||||
}
|
||||
|
||||
// CloseIssue closes an issue with a final comment (feasibility "won't do").
|
||||
func (c *GitHubClient) CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error {
|
||||
if comment != "" {
|
||||
|
||||
Reference in new issue
Block a user