feat: use default issue template when not available

This commit is contained in:
2025-02-22 14:21:30 +01:00
parent e6e5c9b04d
commit 7f6dd60b89
5 changed files with 36 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package gitea
import (
"context"
"net/http"
"slices"
"strconv"
"strings"
@ -33,8 +34,12 @@ func (f *Forge) GetIssueTemplate(ctx context.Context, rawProjectID string) (stri
return "", errors.WithStack(err)
}
data, _, err := f.client.GetFile(project.Owner.UserName, project.Name, project.DefaultBranch, ".gitea/issue_template.md")
data, res, err := f.client.GetFile(project.Owner.UserName, project.Name, project.DefaultBranch, ".gitea/issue_template.md")
if err != nil {
if res.StatusCode == http.StatusNotFound {
return "", errors.WithStack(port.ErrFileNotFound)
}
return "", errors.WithStack(err)
}