mirror of
https://github.com/git-chglog/git-chglog.git
synced 2026-01-22 18:06:11 +00:00
BREAKING CHANGE: `JiraIssueId` has been renamed to `JiraIssueID`. This impacts the value for `pattern_maps` in `config.yml`. * chore(ci): add golangci-lint action * chore(lint): address errcheck lint failures * chore(lint): address misspell lint failures * chore(lint): address gocritic lint failures * chore(lint): address golint lint failures * chore(lint): address structcheck lint failures * chore(lint): address gosimple lint failures * chore(lint): address gofmt lint failures * chore(ci): port to official golangci-lint github action * Update golangci configuration for better coverage Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com> * fix: file is not goimports-ed Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com> * fix: golint and exported functions comments Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com> * chore(lint): address gosec G304 warning * chore(lint): address uparam warnings * chore(lint): address scopelint lint failures * fix: cyclomatic complexity Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com> * chore(lint): address prealloc warning, noting that we are warning for now * chore(lint): address govet and errorlint failures * chore: clean up defer logic when checking errors Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
68 lines
1.3 KiB
Go
68 lines
1.3 KiB
Go
package chglog
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func Example() {
|
|
gen := NewGenerator(NewLogger(os.Stdout, os.Stderr, false, true),
|
|
&Config{
|
|
Bin: "git",
|
|
WorkingDir: ".",
|
|
Template: "CHANGELOG.tpl.md",
|
|
Info: &Info{
|
|
Title: "CHANGELOG",
|
|
RepositoryURL: "https://github.com/git-chglog/git-chglog",
|
|
},
|
|
Options: &Options{
|
|
CommitFilters: map[string][]string{
|
|
"Type": {
|
|
"feat",
|
|
"fix",
|
|
},
|
|
},
|
|
CommitSortBy: "Scope",
|
|
CommitGroupBy: "Type",
|
|
CommitGroupSortBy: "Title",
|
|
CommitGroupTitleMaps: map[string]string{
|
|
"feat": "Features",
|
|
"fix": "Bug Fixes",
|
|
},
|
|
HeaderPattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$",
|
|
HeaderPatternMaps: []string{
|
|
"Type",
|
|
"Scope",
|
|
"Subject",
|
|
},
|
|
IssuePrefix: []string{
|
|
"#",
|
|
"gh-",
|
|
},
|
|
RefActions: []string{},
|
|
MergePattern: "^Merge pull request #(\\d+) from (.*)$",
|
|
MergePatternMaps: []string{
|
|
"Ref",
|
|
"Source",
|
|
},
|
|
RevertPattern: "^Revert \"([\\s\\S]*)\"$",
|
|
RevertPatternMaps: []string{
|
|
"Header",
|
|
},
|
|
NoteKeywords: []string{
|
|
"BREAKING CHANGE",
|
|
},
|
|
},
|
|
})
|
|
|
|
buf := &bytes.Buffer{}
|
|
err := gen.Generate(buf, "")
|
|
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
fmt.Println(buf.String())
|
|
}
|