Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove generated comment in CHANGELOG.md #67

Merged
merged 1 commit into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ var (
versionLinkReg = regexp.MustCompile(`\n\*\*Full Changelog\*\*: (https://.*)$`)
semverFromLinkReg = regexp.MustCompile(`.*[./](v?[0-9]+\.[0-9]+\.[0-9]+)`)
newContribReg = regexp.MustCompile(`(?ms)## New Contributors.*\z`)
genCommentReg = regexp.MustCompile(`<!-- Release notes generated using configuration.*?-->`)
)

func convertKeepAChangelogFormat(md string, d time.Time) string {
md = strings.TrimSpace(md)
md = strings.TrimSpace(genCommentReg.ReplaceAllString(md, ""))

var link string
md = versionLinkReg.ReplaceAllStringFunc(md, func(match string) string {
Expand Down
4 changes: 3 additions & 1 deletion changelog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (

func TestConvertKeepAChangelogFormat(t *testing.T) {

input := `## What's Changed
input := `<!-- Release notes generated using configuration in .github/release.yml at v0.0.12 -->

## What's Changed
* add github.go for github client by @Songmu in https://github.com/Songmu/rcpr/pull/1
* create rc pull request when the default branch proceeded by @Songmu in https://github.com/Songmu/rcpr/pull/2
* dogfooding by @Songmu in https://github.com/Songmu/rcpr/pull/3
Expand Down