@@ -136,7 +136,7 @@ type fetchResult struct {
136136}
137137
138138func FetchRefSHA (ctx context.Context , httpClient * http.Client , repo ghrepo.Interface , tagName string ) (string , error ) {
139- path := fmt .Sprintf ("repos/%s/%s/git/refs /tags/%s" , repo .RepoOwner (), repo .RepoName (), tagName )
139+ path := fmt .Sprintf ("repos/%s/%s/git/ref /tags/%s" , repo .RepoOwner (), repo .RepoName (), tagName )
140140 req , err := http .NewRequestWithContext (ctx , "GET" , ghinstance .RESTPrefix (repo .RepoHost ())+ path , nil )
141141 if err != nil {
142142 return "" , err
@@ -159,17 +159,12 @@ func FetchRefSHA(ctx context.Context, httpClient *http.Client, repo ghrepo.Inter
159159
160160 var ref struct {
161161 Object struct {
162- SHA string `json:"sha,omitempty "`
162+ SHA string `json:"sha"`
163163 } `json:"object"`
164164 }
165165
166166 if err := json .NewDecoder (resp .Body ).Decode (& ref ); err != nil {
167- return "" , fmt .Errorf ("failed to parse Git ref response: %w" , err )
168- }
169-
170- // Check if SHA is empty after successful JSON parsing
171- if ref .Object .SHA == "" {
172- return "" , ErrReleaseNotFound
167+ return "" , fmt .Errorf ("failed to parse ref response: %w" , err )
173168 }
174169
175170 return ref .Object .SHA , nil
@@ -292,7 +287,7 @@ func StubFetchRelease(t *testing.T, reg *httpmock.Registry, owner, repoName, tag
292287}
293288
294289func StubFetchRefSHA (t * testing.T , reg * httpmock.Registry , owner , repoName , tagName , sha string ) {
295- path := fmt .Sprintf ("repos/%s/%s/git/refs /tags/%s" , owner , repoName , tagName )
290+ path := fmt .Sprintf ("repos/%s/%s/git/ref /tags/%s" , owner , repoName , tagName )
296291 reg .Register (
297292 httpmock .REST ("GET" , path ),
298293 httpmock .StringResponse (fmt .Sprintf (`{"object": {"sha": "%s"}}` , sha )),
0 commit comments