Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
changelog-generator-default
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
go-semantic-release
changelog-generator-default
Commits
79f1a369
Commit
79f1a369
authored
Dec 8, 2020
by
timoknapp
Committed by
Christoph Witzko
Dec 9, 2020
Browse files
Options
Downloads
Patches
Plain Diff
chore: now also check for changelog config 'prettify' flag
parent
ecdd4af7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/generator/changelog_generator.go
+19
-3
19 additions, 3 deletions
pkg/generator/changelog_generator.go
pkg/generator/changelog_types.go
+12
-12
12 additions, 12 deletions
pkg/generator/changelog_types.go
with
31 additions
and
15 deletions
pkg/generator/changelog_generator.go
+
19
−
3
View file @
79f1a369
...
@@ -27,9 +27,21 @@ func formatCommit(c *semrel.Commit) string {
...
@@ -27,9 +27,21 @@ func formatCommit(c *semrel.Commit) string {
var
CGVERSION
=
"dev"
var
CGVERSION
=
"dev"
type
DefaultChangelogGenerator
struct
{}
type
DefaultChangelogGenerator
struct
{
prettifyOutput
bool
}
func
(
g
*
DefaultChangelogGenerator
)
Init
(
m
map
[
string
]
string
)
error
{
func
(
g
*
DefaultChangelogGenerator
)
Init
(
m
map
[
string
]
string
)
error
{
prettifyOutput
:=
false
prettifyConfig
:=
m
[
"prettify"
]
if
prettifyConfig
==
"true"
{
prettifyOutput
=
true
}
g
.
prettifyOutput
=
prettifyOutput
return
nil
return
nil
}
}
...
@@ -41,7 +53,7 @@ func (g *DefaultChangelogGenerator) Version() string {
...
@@ -41,7 +53,7 @@ func (g *DefaultChangelogGenerator) Version() string {
return
CGVERSION
return
CGVERSION
}
}
func
(
*
DefaultChangelogGenerator
)
Generate
(
changelogConfig
*
generator
.
ChangelogGeneratorConfig
)
string
{
func
(
g
*
DefaultChangelogGenerator
)
Generate
(
changelogConfig
*
generator
.
ChangelogGeneratorConfig
)
string
{
ret
:=
fmt
.
Sprintf
(
"## %s (%s)
\n\n
"
,
changelogConfig
.
NewVersion
,
time
.
Now
()
.
UTC
()
.
Format
(
"2006-01-02"
))
ret
:=
fmt
.
Sprintf
(
"## %s (%s)
\n\n
"
,
changelogConfig
.
NewVersion
,
time
.
Now
()
.
UTC
()
.
Format
(
"2006-01-02"
))
clTypes
:=
NewChangelogTypes
()
clTypes
:=
NewChangelogTypes
()
for
_
,
commit
:=
range
changelogConfig
.
Commits
{
for
_
,
commit
:=
range
changelogConfig
.
Commits
{
...
@@ -62,7 +74,11 @@ func (*DefaultChangelogGenerator) Generate(changelogConfig *generator.ChangelogG
...
@@ -62,7 +74,11 @@ func (*DefaultChangelogGenerator) Generate(changelogConfig *generator.ChangelogG
if
ct
.
Content
==
""
{
if
ct
.
Content
==
""
{
continue
continue
}
}
ret
+=
fmt
.
Sprintf
(
"#### %s
\n\n
%s
\n
"
,
ct
.
Text
,
ct
.
Content
)
prettifyPrefix
:=
""
if
g
.
prettifyOutput
{
prettifyPrefix
=
ct
.
Emoji
}
ret
+=
fmt
.
Sprintf
(
"#### %s%s
\n\n
%s
\n
"
,
prettifyPrefix
,
ct
.
Text
,
ct
.
Content
)
}
}
return
ret
return
ret
}
}
This diff is collapsed.
Click to expand it.
pkg/generator/changelog_types.go
+
12
−
12
View file @
79f1a369
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment