Merge pull request #2291 from dmcgowan/release-dependencies-changelog

Clean up dependency output
This commit is contained in:
Phil Estes 2018-04-13 18:23:29 -04:00 committed by GitHub
commit 35f0ff957d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -19,6 +19,8 @@ package main
import (
"fmt"
"os"
"sort"
"text/tabwriter"
"text/template"
"github.com/sirupsen/logrus"
@ -115,6 +117,11 @@ This tool should be ran from the root of the project repository for a new releas
if err != nil {
return err
}
sort.Slice(updatedDeps, func(i, j int) bool {
return updatedDeps[i].Name < updatedDeps[j].Name
})
// update the release fields with generated data
r.Contributors = contributors
r.Dependencies = updatedDeps
@ -131,7 +138,12 @@ This tool should be ran from the root of the project repository for a new releas
if err != nil {
return err
}
return t.Execute(os.Stdout, r)
w := tabwriter.NewWriter(os.Stdout, 8, 8, 2, ' ', 0)
if err := t.Execute(w, r); err != nil {
return err
}
return w.Flush()
}
logrus.Info("release complete!")
return nil

View File

@ -48,7 +48,7 @@ https://github.com/{{.GithubRepo}}/issues.
Previous release can be found at [{{.Previous}}](https://github.com/{{.GithubRepo}}/releases/tag/{{.Previous}})
{{range $dep := .Dependencies}}
* {{$dep.Previous}} -> {{$dep.Commit}} **{{$dep.Name}}**
* **{{$dep.Name}}** {{if $dep.Previous}}{{$dep.Previous}} -> {{$dep.Commit}}{{else}}{{$dep.Commit}} **_new_**{{end}}
{{- end}}
`
)