#19 #20
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user