Skip to content

Commit 619e5b9

Browse files
authored
Merge pull request cli#264 from cli/new-repo-name
Have update notifier and changelog link use the new repo name
2 parents 9345571 + 7b28605 commit 619e5b9

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ builds:
1313
- -s -w -X github.com/cli/cli/command.Version={{.Version}} -X github.com/cli/cli/command.BuildDate={{time "2006-01-02"}}
1414
- -X github.com/cli/cli/context.oauthClientID={{.Env.GH_OAUTH_CLIENT_ID}}
1515
- -X github.com/cli/cli/context.oauthClientSecret={{.Env.GH_OAUTH_CLIENT_SECRET}}
16-
- -X main.updaterEnabled=github/homebrew-gh
16+
- -X main.updaterEnabled=cli/cli
1717
goos:
1818
- linux
1919
- darwin

command/root.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ func colorableErr(cmd *cobra.Command) io.Writer {
142142
}
143143

144144
func changelogURL(version string) string {
145-
path := "https://github.com/github/homebrew-gh"
146-
r := regexp.MustCompile(`^v\d+\.\d+.\d+$`)
145+
path := "https://github.com/cli/cli"
146+
r := regexp.MustCompile(`^\d+\.\d+.\d+(-[\w.]+)?$`)
147147
if !r.MatchString(version) {
148148
return fmt.Sprintf("%s/releases/latest", path)
149149
}
150150

151-
tag := version
152-
url := fmt.Sprintf("%s/releases/tag/%s", path, tag)
151+
url := fmt.Sprintf("%s/releases/tag/v%s", path, version)
153152
return url
154153
}

command/root_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,29 @@ import (
66
)
77

88
func TestChangelogURL(t *testing.T) {
9-
tag := "v0.3.2"
10-
url := fmt.Sprintf("https://github.com/github/homebrew-gh/releases/tag/v0.3.2")
9+
tag := "0.3.2"
10+
url := fmt.Sprintf("https://github.com/cli/cli/releases/tag/v0.3.2")
1111
result := changelogURL(tag)
1212
if result != url {
1313
t.Errorf("expected %s to create url %s but got %s", tag, url, result)
1414
}
1515

16+
tag = "0.3.2-pre.1"
17+
url = fmt.Sprintf("https://github.com/cli/cli/releases/tag/v0.3.2-pre.1")
18+
result = changelogURL(tag)
19+
if result != url {
20+
t.Errorf("expected %s to create url %s but got %s", tag, url, result)
21+
}
22+
1623
tag = "0.3.5-90-gdd3f0e0"
17-
url = fmt.Sprintf("https://github.com/github/homebrew-gh/releases/latest")
24+
url = fmt.Sprintf("https://github.com/cli/cli/releases/latest")
1825
result = changelogURL(tag)
1926
if result != url {
2027
t.Errorf("expected %s to create url %s but got %s", tag, url, result)
2128
}
2229

2330
tag = "deadbeef"
24-
url = fmt.Sprintf("https://github.com/github/homebrew-gh/releases/latest")
31+
url = fmt.Sprintf("https://github.com/cli/cli/releases/latest")
2532
result = changelogURL(tag)
2633
if result != url {
2734
t.Errorf("expected %s to create url %s but got %s", tag, url, result)

0 commit comments

Comments
 (0)