changelog icon indicating copy to clipboard operation
changelog copied to clipboard

Add a latest command that shows the latest released version

Open mattwynne opened this issue 4 years ago • 10 comments
trafficstars

I wanted a way to get the latest released version number out of my CHANGELOG.md

I hope this is useful!

I've test-driven the changes, so hopefully it should all be good for any refactoring.

I did consider adding this as a default to the show command if you didn't specify a version to show, but that command doesn't actually show the version number, which is what I need.

This does allow you to do changelog show `changelog latest` to show the details of the latest release.

Note that this is my first Go code, so:

a) please be gentle with your feedback b) thanks for writing such an easy-to-navigate codebase that I could learn from and so easily contribute to!

mattwynne avatar Jul 21 '21 19:07 mattwynne

@mattwynne Thanks for your contribution - really good! Just one minor comment - if you could move that logic out of the command it would be great and then I think we are ready to merge

Edit: just authorized the checks and it seems some of them failed - do you mind checking, please?

rcmachado avatar Aug 20 '21 12:08 rcmachado

Thanks for taking a look @rcmachado and sorry for the lag - my GitHub notifications were going into a folder I don't look in very often.

I'm a bit confused by the check failures. The lint task shows golangci-lint found no issues so I'm not sure why that counts a failure.

The goreleaser error looks like maybe their manifest format has changed between versions of goreleaser? The error says:

line 13: field builds not found in type config.Docker
line 15: field binaries not found in type config.Docker

mattwynne avatar Sep 09 '21 06:09 mattwynne

@rcmachado I'd appreciate some help with the linter / goreleaser warnings if you can spare the time. I'm a bit stuck understanding their feedback.

mattwynne avatar Sep 20 '21 18:09 mattwynne

I think it would be more unix'y (i.e. versatile) if this were refactored to a list command that lists all releases. That would be a command that can be used for a lot more. The output could be piped to grep, head, tail, cut etc to extract a particular release.

Suggested output from changelog list (TSV):

Unreleased\t\thttp://example.com/1.0.0..HEAD\t
1.0.0\t2018-04-23\thttp://example.com/abcdef..1.0.0\ttrue

The column headers would not be printed (just like ls -al doesn't print the column headers), but they would be:

Name\tDate\nLink\nYanked

aslakhellesoy avatar Sep 21 '21 18:09 aslakhellesoy

I thought about this some more, and implemented #78 which adds a --json option to fmt and show. That makes it easy to get the latest version (and more) by piping to jq.

WDYT?

aslakhellesoy avatar Sep 22 '21 19:09 aslakhellesoy

I think a list that just listed all the versions could be useful - you could then use show to look at a particular one.

The JSON output seems like a great idea to me, very versatile! Can we have both!?

mattwynne avatar Sep 22 '21 19:09 mattwynne

@mattwynne we don't need a new list command. The fmt --json command lists the entire changelog as JSON. See the example in #78

aslakhellesoy avatar Sep 22 '21 19:09 aslakhellesoy

@mattwyne sorry for the delay - time has been a scarce resource lately.

About CI process failing, couldn't take a look yet but could be something related to tools been updated and rules changed? I don't build this project since some time

rcmachado avatar Sep 28 '21 10:09 rcmachado

Any news on this? I would like to see this.

tina-junold avatar Dec 08 '22 11:12 tina-junold

Hey @tburschka. We have this implemented in our fork: https://github.com/cucumber/changelog

mattwynne avatar Dec 23 '22 05:12 mattwynne