Skip to content

Commit 9146034

Browse files
committed
Check release references exist in the cache before trying to push them.
1 parent 06cf2d3 commit 9146034

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/push/push.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ func (pushService *pushService) pushGit(repository *github.Repository, initialPu
215215
}
216216
initialRefSpecs := []config.RefSpec{}
217217
for _, releasePathStat := range releasePathStats {
218-
initialRefSpecs = append(initialRefSpecs, config.RefSpec("+refs/tags/"+releasePathStat.Name()+":refs/tags/"+releasePathStat.Name()))
218+
tagReferenceName := plumbing.NewTagReferenceName(releasePathStat.Name())
219+
_, err := gitRepository.Reference(tagReferenceName, true)
220+
if err != nil {
221+
return errors.Wrapf(err, "Error finding local tag reference %s.", tagReferenceName)
222+
}
223+
initialRefSpecs = append(initialRefSpecs, config.RefSpec("+"+tagReferenceName.String()+":"+tagReferenceName.String()))
219224
}
220225
refSpecBatches = append(refSpecBatches, initialRefSpecs)
221226
} else {

0 commit comments

Comments
 (0)