Respect --token argument on github too

This commit is contained in:
6543 2023-06-23 14:28:22 +02:00
parent 07c0fc1414
commit ae9006322a
No known key found for this signature in database
GPG Key ID: B8BE6D610E61C862
1 changed files with 9 additions and 3 deletions

View File

@ -26,11 +26,17 @@ type GitHub struct {
// Generate returns a GitHub changelog
func (gh *GitHub) Generate() (string, []Entry, error) {
tagURL := fmt.Sprintf("## [%s](https://github.com/%s/releases/tag/%s) - %s", gh.Milestone, gh.Repo, gh.GitTag, time.Now().Format("2006-01-02"))
client := github.NewClient(httpClient())
ctx := context.Background()
tagURL := fmt.Sprintf("## [%s](https://github.com/%s/releases/tag/%s) - %s", gh.Milestone, gh.Repo, gh.GitTag, time.Now().Format("2006-01-02"))
var client *github.Client
if gh.Token != "" {
client = github.NewTokenClient(ctx, gh.Token)
} else {
client = github.NewClient(httpClient())
}
prs := make([]Entry, 0)
state := "merged"