Skip to content

Commit 2e662d4

Browse files
authored
Merge pull request #65 from github/check-references-exist
Check release references exist in the cache before trying to push them.
2 parents 6ac01ae + 9146034 commit 2e662d4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/push/push.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ func (pushService *pushService) pushGit(repository *github.Repository, initialPu
219219
}
220220
initialRefSpecs := []config.RefSpec{}
221221
for _, releasePathStat := range releasePathStats {
222-
initialRefSpecs = append(initialRefSpecs, config.RefSpec("+refs/tags/"+releasePathStat.Name()+":refs/tags/"+releasePathStat.Name()))
222+
tagReferenceName := plumbing.NewTagReferenceName(releasePathStat.Name())
223+
_, err := gitRepository.Reference(tagReferenceName, true)
224+
if err != nil {
225+
return errors.Wrapf(err, "Error finding local tag reference %s.", tagReferenceName)
226+
}
227+
initialRefSpecs = append(initialRefSpecs, config.RefSpec("+"+tagReferenceName.String()+":"+tagReferenceName.String()))
223228
}
224229
refSpecBatches = append(refSpecBatches, initialRefSpecs)
225230
} else {

0 commit comments

Comments
 (0)