#8 after create PR, delete local branch.
This commit is contained in:
parent
6943db5b55
commit
c15245df57
@ -277,6 +277,21 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
|
||||
return fmt.Errorf("unknown error: %s", buf)
|
||||
}
|
||||
|
||||
if err = wtree.Checkout(&git.CheckoutOptions{
|
||||
Hash: headRef.Hash(),
|
||||
Branch: headRef.Name(),
|
||||
Create: false,
|
||||
Force: true,
|
||||
}); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to checkout tree: %v", err))
|
||||
return err
|
||||
}
|
||||
|
||||
err = repo.DeleteBranch(fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version))
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("Delete local branch error: %s", err))
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("PR create for %s-%s", path, mod.Version))
|
||||
|
||||
repo, err = git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
|
||||
|
Loading…
Reference in New Issue
Block a user