Add failing specs for commit_sha file and metadata

This commit is contained in:
Christoph Sassenberg
2017-10-12 14:21:50 +02:00
parent 0c66a411ee
commit a200915862
4 changed files with 110 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ type GitHub interface {
GetTarballLink(tag string) (*url.URL, error)
GetZipballLink(tag string) (*url.URL, error)
GetRef(tag string) (*github.Reference, error)
}
type GitHubClient struct {
@@ -247,6 +248,15 @@ func (g *GitHubClient) GetZipballLink(tag string) (*url.URL, error) {
return u, nil
}
func (g *GitHubClient) GetRef(tag string) (*github.Reference, error) {
ref, res, err := g.client.Git.GetRef(context.TODO(), g.owner, g.repository, "tags/"+tag)
if err != nil {
return nil, err
}
res.Body.Close()
return ref, nil
}
func oauthClient(ctx context.Context, source Source) (*http.Client, error) {
ts := oauth2.StaticTokenSource(&oauth2.Token{
AccessToken: source.AccessToken,