Add changelog link to gh version and gh --version#221
Conversation
mislav
left a comment
There was a problem hiding this comment.
Nice, simple implementation!
|
|
||
| func changelogURL(version string) string { | ||
| path := "https://github.com/github/homebrew-gh" | ||
| r := regexp.MustCompile(`^v\d+\.\d+.\d+$`) |
There was a problem hiding this comment.
Is this mechanism designed to avoid matching prereleases, e.g. v1.2.3-pre.5, or could we consider supporting them? Since we already use them.
There was a problem hiding this comment.
It was mostly to avoid our dev release version numbers like 0.3.5-97-g4f97cda. I can make it work with pre-releases too.
| path := "https://github.com/github/homebrew-gh" | ||
| r := regexp.MustCompile(`^v\d+\.\d+.\d+$`) | ||
| if !r.MatchString(version) { | ||
| return fmt.Sprintf("%s/releases/latest", path) |
There was a problem hiding this comment.
I'm not sure about this fallback to /releases/latest— if the point of this feature is to link users to release notes that are directly applicable to their version of CLI, wouldn't linking to /latest break that promise, since the user's currently installed CLI version might not be the latest stable release?
There was a problem hiding this comment.
Maybe not showing any url makes more sense in that case?
Add changelog link to `gh version` and `gh --version`
- Add a single script that runs the commands we want contributions to run.
- Revamp the contribution template by:
- Using HTML comments to guide the author, reducing the need to delete the text
- Converting the type of change to be a flat list, allowing authors to delete all except the one they want
- Updated the checklist items to allow items that are unnecessary to still be checked
Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
This was pretty straight forward. If the version matches the vX.X.X pattern it will give a link to that tag. If it doesn't the url will link to the latest changelog.
One thing that was a little tricky was getting it to work with the build-in
--versionflag that Cobra uses. To get around this and havegh versionandgh --versionuse the same string I used theSetVersionTemplatemethod https://github.com/spf13/cobra#version-flagCloses #111