feat: issue creation
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user