#8 skip path if branch exists #12

Merged
vtolstov merged 90 commits from kgorbunov/pkgdash:master into master 2024-04-03 08:28:17 +03:00
Showing only changes of commit 6a62fe499e - Show all commits

View File

@ -373,8 +373,9 @@ func (g *Gitea) RequestUpdate(ctx context.Context, branch string, path string, m
func (g *Gitea) RequestList(ctx context.Context, branch string) (map[string]string, error) {
logger.Debugf(ctx, fmt.Sprintf("RequestList for %s", branch))
var err error
gPulls, err := GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Token)
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Token)
if err != nil {
return nil, err
}
@ -382,14 +383,13 @@ func (g *Gitea) RequestList(ctx context.Context, branch string) (map[string]stri
var path string
rMap := make(map[string]string)
for _, pull := range gPulls {
for _, pull := range g.pulls {
if !strings.HasPrefix(pull.Title, "Bump ") { //добавляем только реквесты бота по обновлению модулей
continue
}
path = strings.Split(pull.Title, " ")[1] //todo Работет только для дефолтного шаблона
rMap[path] = pull.Title
}
return rMap, nil
}
@ -413,10 +413,11 @@ func DeleteBranch(ctx context.Context, url, owner, repo, branch, token string) (
}
func GetPulls(ctx context.Context, url, owner, repo, token string) ([]*giteaPull, error) {
var pullsAll, pulls []*giteaPull
var pullsAll []*giteaPull
page := 1
for {
pulls := make([]*giteaPull, 0, 10)
req, err := http.NewRequestWithContext(
ctx,
http.MethodGet,