Skip to content

Commit 8cad036

Browse files
fix(github): only allow commit tags
1 parent 159c21f commit 8cad036

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/semrel/github.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ func (repo *GitHubRepository) GetLatestRelease(vrange string, re *regexp.Regexp)
8282
if re != nil && !re.MatchString(tag) {
8383
continue
8484
}
85+
if r.Object.GetType() != "commit" {
86+
continue
87+
}
8588
version, err := semver.NewVersion(tag)
8689
if err != nil {
8790
continue

pkg/semrel/github_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ func createGithubCommit(sha, message string) *github.RepositoryCommit {
3838
return &github.RepositoryCommit{SHA: &sha, Commit: &github.Commit{Message: &message}}
3939
}
4040

41+
var commitType = "commit"
42+
4143
func createGithubRef(ref, sha string) *github.Reference {
42-
return &github.Reference{Ref: &ref, Object: &github.GitObject{SHA: &sha}}
44+
return &github.Reference{Ref: &ref, Object: &github.GitObject{SHA: &sha, Type: &commitType}}
4345
}
4446

4547
var (

0 commit comments

Comments
 (0)