#8 skip path if branch exists #12
@ -277,21 +277,6 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
|
|||||||
return fmt.Errorf("unknown error: %s", buf)
|
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))
|
logger.Info(ctx, fmt.Sprintf("PR create for %s-%s", path, mod.Version))
|
||||||
|
|
||||||
repo, err = git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
|
repo, err = git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
|
||||||
@ -451,10 +436,6 @@ func GetPulls(ctx context.Context, url, owner, repo, token string) ([]*giteaPull
|
|||||||
|
|
||||||
buf, _ := io.ReadAll(rsp.Body)
|
buf, _ := io.ReadAll(rsp.Body)
|
||||||
|
|
||||||
if buf == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
switch rsp.StatusCode {
|
switch rsp.StatusCode {
|
||||||
case http.StatusOK:
|
case http.StatusOK:
|
||||||
if err = json.Unmarshal(buf, &pulls); err != nil {
|
if err = json.Unmarshal(buf, &pulls); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user