func FetchTags(githubRepoUrl string, githubToken string, instance GitHubInstance) ([]string, *FetchError) {
	var tagsString []string
	repo, err := ParseUrlIntoGitHubRepo(githubRepoUrl, githubToken, instance)
	if err != nil {
		return tagsString, wrapError(err)
	}
	tagsUrl := formatUrl(repo, createGitHubRepoUrlForPath(repo, "tags?per_page=100"))
	for tagsUrl != "" {
		resp, err := callGitHubApiRaw(tagsUrl, "GET", repo.Token, map[string]string{})
		if err != nil {
			return tagsString, err
		}
		buf := new(bytes.Buffer)
		_, goErr := buf.ReadFrom(resp.Body)
		if goErr != nil {
			return tagsString, wrapError(goErr)
		}
		jsonResp := buf.Bytes()
		var tags []GitHubTagsApiResponse
		if err := json.Unmarshal(jsonResp, &tags); err != nil {
			return tagsString, wrapError(err)
		}
		for _, tag := range tags {
			if _, err := version.NewVersion(tag.Name); err == nil {
				tagsString = append(tagsString, tag.Name)
			}
		}
		tagsUrl = getNextUrl(resp.Header.Get("link"))
	}
	return tagsString, nil
}
Fetch all SemVer tags from the given GitHub repo
package main
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"os"
	"regexp"
	"strings"
	"github.com/dustin/go-humanize"
	"github.com/hashicorp/go-version"
	"github.com/sirupsen/logrus"
)
type GitHubRepo struct {
	Url     string  
	BaseUrl string  
	ApiUrl  string  
	Owner   string  
	Name    string  
	Token   string  
}
type GitHubInstance struct {
	BaseUrl string
	ApiUrl  string
}
type GitHubCommit struct {
	Repo       GitHubRepo  
	GitRef     string      
	GitTag     string      
	BranchName string      
	CommitSha  string      
}
type GitHubTagsApiResponse struct {
	Name       string  
	ZipBallUrl string  
	TarballUrl string  
	Commit     GitHubTagsCommitApiResponse
}
type GitHubTagsCommitApiResponse struct {
	Sha string  
	Url string  
}
type GitHubReleaseApiResponse struct {
	Id     int
	Url    string
	Name   string
	Assets []GitHubReleaseAsset
}
type GitHubReleaseAsset struct {
	Id   int
	Url  string
	Name string
}
func ParseUrlIntoGithubInstance(logger *logrus.Logger, repoUrl string, apiv string) (GitHubInstance, *FetchError) {
	var instance GitHubInstance
	u, err := url.Parse(repoUrl)
	if err != nil {
		return instance, newError(githubRepoUrlMalformedOrNotParseable, fmt.Sprintf("GitHub Repo URL %s is malformed.", repoUrl))
	}
	baseUrl := u.Host
	apiUrl := "api.github.com"
	if baseUrl != "github.com" && baseUrl != "www.github.com" {
		logger.Infof("Assuming GitHub Enterprise since the provided url (%s) does not appear to be for GitHub.com\n", repoUrl)
		apiUrl = baseUrl + "/api/" + apiv
	}
	instance = GitHubInstance{
		BaseUrl: baseUrl,
		ApiUrl:  apiUrl,
	}
	return instance, nil
}