feat: issue creation

This commit is contained in:
2025-02-22 18:01:45 +01:00
parent 5b148cb4bb
commit 2d83ca9d20
10 changed files with 258 additions and 40 deletions

View File

@ -18,8 +18,26 @@ type Forge struct {
}
// CreateIssue implements port.Forge.
func (f *Forge) CreateIssue(ctx context.Context, projectID string, title string, content string) error {
return nil
func (f *Forge) CreateIssue(ctx context.Context, rawProjectID string, title string, body string) (string, error) {
projectID, err := strconv.ParseInt(rawProjectID, 10, 64)
if err != nil {
return "", errors.WithStack(err)
}
project, _, err := f.client.GetRepoByID(projectID)
if err != nil {
return "", errors.WithStack(err)
}
issue, _, err := f.client.CreateIssue(project.Owner.UserName, project.Name, gitea.CreateIssueOption{
Title: title,
Body: body,
})
if err != nil {
return "", errors.WithStack(err)
}
return issue.HTMLURL, nil
}
// GetIssueTemplate implements port.Forge.