Merge pull request 'fix(api): error 500 on tag creation when a workflow exists' (#3324) from earl-warren/forgejo:wip-v1.21-tag-api-regression into v1.21/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3324
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-04-19 09:38:18 +00:00
commit f702129854

View file

@ -30,13 +30,11 @@ func CreateCommitStatus(ctx context.Context, repo *repo_model.Repository, creato
defer closer.Close()
if commit, err := gitRepo.GetCommit(sha); err != nil {
gitRepo.Close()
return fmt.Errorf("GetCommit[%s]: %w", sha, err)
} else if len(sha) != git.SHAFullLength {
// use complete commit sha
sha = commit.ID.String()
}
gitRepo.Close()
if err := git_model.NewCommitStatus(ctx, git_model.NewCommitStatusOptions{
Repo: repo,