hashicorp / go-changelog

Changelog generation based on files in a directory.
Mozilla Public License 2.0
107 stars 20 forks source link

add stringHasPrefix to template #4

Closed hanshasselberg closed 4 years ago

hanshasselberg commented 4 years ago

Fixes https://github.com/hashicorp/go-changelog/issues/3. This is something we want to use in consul to determine if a link should be displayed or not. We plan to prefix changelog entry files that don't generate a link to an issue with ..

Eg .1234.txt with this content:

```release-note:enhancement
Added the `bar` interface.
```

and this note template:

{{- define "note" -}}
{{.Body}}{{if not stringHasPrefix .Issue "."}} [[GH-{{- .Issue -}}](https://github.com/hashicorp/consul/issues/{{- .Issue -}})]{{end}}
{{- end -}}

wouldn't generate a link.