#8 change Update.
This commit is contained in:
@@ -63,7 +63,7 @@ type giteaPull struct {
|
||||
}
|
||||
|
||||
func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
logger.Debugf(ctx, "RequestOpen start, mod title: %s", path)
|
||||
logger.Debugf(ctx, fmt.Sprintf("RequestOpen start, mod title: %s", path))
|
||||
|
||||
var buf []byte
|
||||
var err error
|
||||
@@ -112,6 +112,7 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
|
||||
refIter, err := repo.Branches() //получение веток
|
||||
if err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to get branches: %v", err))
|
||||
return err
|
||||
}
|
||||
for {
|
||||
ref, err := refIter.Next()
|
||||
@@ -127,9 +128,10 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
|
||||
|
||||
if headRef == nil {
|
||||
logger.Fatal(ctx, "failed to get repo branch head")
|
||||
return err
|
||||
} // Не получили нужную ветку
|
||||
|
||||
logger.Info(ctx, "repo head %s", headRef)
|
||||
logger.Info(ctx, fmt.Sprintf("repo head %s", headRef))
|
||||
|
||||
wtree, err := repo.Worktree() //todo вроде рабочее дерево не нужно
|
||||
if err != nil {
|
||||
@@ -279,7 +281,7 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
|
||||
}
|
||||
|
||||
func (g *Gitea) RequestClose(ctx context.Context, branch string, path string) error {
|
||||
logger.Debugf(ctx, "RequestClose start, mod title: %s", path)
|
||||
logger.Debugf(ctx, fmt.Sprintf("RequestClose start, mod title: %s", path))
|
||||
|
||||
pulls, err := GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Token)
|
||||
if err != nil {
|
||||
@@ -317,7 +319,7 @@ func (g *Gitea) RequestClose(ctx context.Context, branch string, path string) er
|
||||
}
|
||||
|
||||
func (g *Gitea) RequestUpdate(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
logger.Debugf(ctx, "RequestUpdate start, mod title: %s", path)
|
||||
logger.Debugf(ctx, fmt.Sprintf("RequestUpdate start, mod title: %s", path))
|
||||
|
||||
pulls, err := GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Token)
|
||||
if err != nil {
|
||||
@@ -342,6 +344,8 @@ func (g *Gitea) RequestUpdate(ctx context.Context, branch string, path string, m
|
||||
continue //думаю что если не можем удалить ветку не стоит заканчивать работу, а перейти к следующей итерации
|
||||
}
|
||||
logger.Info(ctx, fmt.Sprintf("Old pr %s successful delete", pull.Head.Ref))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
prExist = true
|
||||
}
|
||||
|
Reference in New Issue
Block a user