Skip to content

Commit

Permalink
Merge pull request #65 from github/check-references-exist
Browse files Browse the repository at this point in the history
Check release references exist in the cache before trying to push them.
  • Loading branch information
chrisgavin authored Apr 6, 2022
2 parents 6ac01ae + 9146034 commit 2e662d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/push/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ func (pushService *pushService) pushGit(repository *github.Repository, initialPu
}
initialRefSpecs := []config.RefSpec{}
for _, releasePathStat := range releasePathStats {
initialRefSpecs = append(initialRefSpecs, config.RefSpec("+refs/tags/"+releasePathStat.Name()+":refs/tags/"+releasePathStat.Name()))
tagReferenceName := plumbing.NewTagReferenceName(releasePathStat.Name())
_, err := gitRepository.Reference(tagReferenceName, true)
if err != nil {
return errors.Wrapf(err, "Error finding local tag reference %s.", tagReferenceName)
}
initialRefSpecs = append(initialRefSpecs, config.RefSpec("+"+tagReferenceName.String()+":"+tagReferenceName.String()))
}
refSpecBatches = append(refSpecBatches, initialRefSpecs)
} else {
Expand Down

0 comments on commit 2e662d4

Please sign in to comment.