|
|
@ -7,6 +7,7 @@ package migrations |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"context" |
|
|
|
"context" |
|
|
|
|
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
"os" |
|
|
|
"os" |
|
|
@ -253,7 +254,6 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error { |
|
|
|
LowerTagName: strings.ToLower(release.TagName), |
|
|
|
LowerTagName: strings.ToLower(release.TagName), |
|
|
|
Target: release.TargetCommitish, |
|
|
|
Target: release.TargetCommitish, |
|
|
|
Title: release.Name, |
|
|
|
Title: release.Name, |
|
|
|
Sha1: release.TargetCommitish, |
|
|
|
|
|
|
|
Note: release.Body, |
|
|
|
Note: release.Body, |
|
|
|
IsDraft: release.Draft, |
|
|
|
IsDraft: release.Draft, |
|
|
|
IsPrerelease: release.Prerelease, |
|
|
|
IsPrerelease: release.Prerelease, |
|
|
@ -265,15 +265,18 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// calc NumCommits if no draft
|
|
|
|
// calc NumCommits if possible
|
|
|
|
if !release.Draft { |
|
|
|
if rel.TagName != "" { |
|
|
|
commit, err := g.gitRepo.GetTagCommit(rel.TagName) |
|
|
|
commit, err := g.gitRepo.GetTagCommit(rel.TagName) |
|
|
|
if err != nil { |
|
|
|
if !errors.Is(err, git.ErrNotExist{}) { |
|
|
|
return fmt.Errorf("GetTagCommit[%v]: %v", rel.TagName, err) |
|
|
|
if err != nil { |
|
|
|
} |
|
|
|
return fmt.Errorf("GetTagCommit[%v]: %v", rel.TagName, err) |
|
|
|
rel.NumCommits, err = commit.CommitsCount() |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
rel.Sha1 = commit.ID.String() |
|
|
|
return fmt.Errorf("CommitsCount: %v", err) |
|
|
|
rel.NumCommits, err = commit.CommitsCount() |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return fmt.Errorf("CommitsCount: %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|