Merge pull request #264 from cli/new-repo-name
Have update notifier and changelog link use the new repo name
This commit is contained in:
commit
619e5b9e58
3 changed files with 15 additions and 9 deletions
|
|
@ -13,7 +13,7 @@ builds:
|
|||
- -s -w -X github.com/cli/cli/command.Version={{.Version}} -X github.com/cli/cli/command.BuildDate={{time "2006-01-02"}}
|
||||
- -X github.com/cli/cli/context.oauthClientID={{.Env.GH_OAUTH_CLIENT_ID}}
|
||||
- -X github.com/cli/cli/context.oauthClientSecret={{.Env.GH_OAUTH_CLIENT_SECRET}}
|
||||
- -X main.updaterEnabled=github/homebrew-gh
|
||||
- -X main.updaterEnabled=cli/cli
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
|
|
|
|||
|
|
@ -142,13 +142,12 @@ func colorableErr(cmd *cobra.Command) io.Writer {
|
|||
}
|
||||
|
||||
func changelogURL(version string) string {
|
||||
path := "https://github.com/github/homebrew-gh"
|
||||
r := regexp.MustCompile(`^v\d+\.\d+.\d+$`)
|
||||
path := "https://github.com/cli/cli"
|
||||
r := regexp.MustCompile(`^\d+\.\d+.\d+(-[\w.]+)?$`)
|
||||
if !r.MatchString(version) {
|
||||
return fmt.Sprintf("%s/releases/latest", path)
|
||||
}
|
||||
|
||||
tag := version
|
||||
url := fmt.Sprintf("%s/releases/tag/%s", path, tag)
|
||||
url := fmt.Sprintf("%s/releases/tag/v%s", path, version)
|
||||
return url
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,22 +6,29 @@ import (
|
|||
)
|
||||
|
||||
func TestChangelogURL(t *testing.T) {
|
||||
tag := "v0.3.2"
|
||||
url := fmt.Sprintf("https://github.com/github/homebrew-gh/releases/tag/v0.3.2")
|
||||
tag := "0.3.2"
|
||||
url := fmt.Sprintf("https://github.com/cli/cli/releases/tag/v0.3.2")
|
||||
result := changelogURL(tag)
|
||||
if result != url {
|
||||
t.Errorf("expected %s to create url %s but got %s", tag, url, result)
|
||||
}
|
||||
|
||||
tag = "0.3.2-pre.1"
|
||||
url = fmt.Sprintf("https://github.com/cli/cli/releases/tag/v0.3.2-pre.1")
|
||||
result = changelogURL(tag)
|
||||
if result != url {
|
||||
t.Errorf("expected %s to create url %s but got %s", tag, url, result)
|
||||
}
|
||||
|
||||
tag = "0.3.5-90-gdd3f0e0"
|
||||
url = fmt.Sprintf("https://github.com/github/homebrew-gh/releases/latest")
|
||||
url = fmt.Sprintf("https://github.com/cli/cli/releases/latest")
|
||||
result = changelogURL(tag)
|
||||
if result != url {
|
||||
t.Errorf("expected %s to create url %s but got %s", tag, url, result)
|
||||
}
|
||||
|
||||
tag = "deadbeef"
|
||||
url = fmt.Sprintf("https://github.com/github/homebrew-gh/releases/latest")
|
||||
url = fmt.Sprintf("https://github.com/cli/cli/releases/latest")
|
||||
result = changelogURL(tag)
|
||||
if result != url {
|
||||
t.Errorf("expected %s to create url %s but got %s", tag, url, result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue