@@ -45,11 +45,16 @@ func createGithubCommit(sha, message string) *github.RepositoryCommit {
45
45
}
46
46
47
47
var commitType = "commit"
48
+ var tagType = "tag"
48
49
49
50
func createGithubRef (ref , sha string ) * github.Reference {
50
51
return & github.Reference {Ref : & ref , Object : & github.GitObject {SHA : & sha , Type : & commitType }}
51
52
}
52
53
54
+ func createGithubRefWithTag (ref , sha string ) * github.Reference {
55
+ return & github.Reference {Ref : & ref , Object : & github.GitObject {SHA : & sha , Type : & tagType }}
56
+ }
57
+
53
58
var (
54
59
GITHUB_REPO_PRIVATE = true
55
60
GITHUB_DEFAULTBRANCH = "master"
81
86
createGithubRef ("refs/tags/v3.0.0-beta.2" , "deadbeef" ),
82
87
createGithubRef ("refs/tags/v3.0.0-beta.1" , "deadbeef" ),
83
88
createGithubRef ("refs/tags/2020.04.19" , "deadbeef" ),
89
+ createGithubRefWithTag ("refs/tags/v1.1.1" , "12345678" ),
84
90
}
85
91
)
86
92
@@ -132,6 +138,13 @@ func githubHandler(w http.ResponseWriter, r *http.Request) {
132
138
fmt .Fprint (w , "{}" )
133
139
return
134
140
}
141
+ if r .Method == "GET" && r .URL .Path == "/repos/owner/test-repo/git/tags/12345678" {
142
+ sha := "deadbeef"
143
+ json .NewEncoder (w ).Encode (github.Tag {
144
+ Object : & github.GitObject {SHA : & sha , Type : & commitType },
145
+ })
146
+ return
147
+ }
135
148
http .Error (w , "invalid route" , http .StatusNotImplemented )
136
149
}
137
150
0 commit comments