mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-02-07 10:17:02 +00:00
fix: using code blocks within release-notes
Increase the number of code blocks backticks to 4 for the release note prefix and suffix, to allow users to embed their own code blocks using only 3 backticks.
This commit is contained in:
parent
93bb42e781
commit
7f25b3bf92
13 changed files with 229 additions and 103 deletions
|
|
@ -15,18 +15,18 @@ If you want to modify the proposed release, add you overrides here. You can lear
|
|||
|
||||
This will be added to the start of the release notes.
|
||||
|
||||
```rp-prefix
|
||||
~~~~rp-prefix
|
||||
{{- if .Overrides.Prefix }}
|
||||
{{ .Overrides.Prefix }}{{ end }}
|
||||
```
|
||||
~~~~
|
||||
|
||||
### Suffix / End
|
||||
|
||||
This will be added to the end of the release notes.
|
||||
|
||||
```rp-suffix
|
||||
~~~~rp-suffix
|
||||
{{- if .Overrides.Suffix }}
|
||||
{{ .Overrides.Suffix }}{{ end }}
|
||||
```
|
||||
~~~~
|
||||
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/apricote/releaser-pleaser/internal/git"
|
||||
"github.com/apricote/releaser-pleaser/internal/testdata"
|
||||
"github.com/apricote/releaser-pleaser/internal/versioning"
|
||||
)
|
||||
|
||||
|
|
@ -37,20 +38,24 @@ func TestReleasePullRequest_GetOverrides(t *testing.T) {
|
|||
name: "prefix in description",
|
||||
pr: ReleasePullRequest{
|
||||
PullRequest: git.PullRequest{
|
||||
Description: "```rp-prefix\n## Foo\n\n- Cool thing\n```",
|
||||
Description: testdata.MustReadFileString(t, "description-prefix.txt"),
|
||||
},
|
||||
},
|
||||
want: ReleaseOverrides{Prefix: "## Foo\n\n- Cool thing"},
|
||||
want: ReleaseOverrides{
|
||||
Prefix: testdata.MustReadFileString(t, "prefix.txt"),
|
||||
},
|
||||
wantErr: assert.NoError,
|
||||
},
|
||||
{
|
||||
name: "suffix in description",
|
||||
pr: ReleasePullRequest{
|
||||
PullRequest: git.PullRequest{
|
||||
Description: "```rp-suffix\n## Compatibility\n\nNo compatibility guarantees.\n```",
|
||||
Description: testdata.MustReadFileString(t, "description-suffix.txt"),
|
||||
},
|
||||
},
|
||||
want: ReleaseOverrides{Suffix: "## Compatibility\n\nNo compatibility guarantees."},
|
||||
want: ReleaseOverrides{
|
||||
Suffix: testdata.MustReadFileString(t, "suffix.txt"),
|
||||
},
|
||||
wantErr: assert.NoError,
|
||||
},
|
||||
}
|
||||
|
|
@ -80,30 +85,10 @@ func TestReleasePullRequest_ChangelogText(t *testing.T) {
|
|||
wantErr: assert.NoError,
|
||||
},
|
||||
{
|
||||
name: "with section",
|
||||
description: `# Foobar
|
||||
|
||||
<!-- section-start changelog -->
|
||||
This is the changelog
|
||||
|
||||
## Awesome
|
||||
|
||||
### New
|
||||
|
||||
#### Changes
|
||||
<!-- section-end changelog -->
|
||||
|
||||
Suffix Things
|
||||
`,
|
||||
want: `This is the changelog
|
||||
|
||||
## Awesome
|
||||
|
||||
### New
|
||||
|
||||
#### Changes
|
||||
`,
|
||||
wantErr: assert.NoError,
|
||||
name: "with section",
|
||||
description: testdata.MustReadFileString(t, "changelog.txt"),
|
||||
want: testdata.MustReadFileString(t, "changelog-content.txt"),
|
||||
wantErr: assert.NoError,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
|
@ -178,75 +163,17 @@ func TestReleasePullRequest_SetDescription(t *testing.T) {
|
|||
name: "no overrides",
|
||||
changelogEntry: `## v1.0.0`,
|
||||
overrides: ReleaseOverrides{},
|
||||
want: `<!-- section-start changelog -->
|
||||
## v1.0.0
|
||||
<!-- section-end changelog -->
|
||||
|
||||
---
|
||||
|
||||
<details>
|
||||
<summary><h4>PR by <a href="https://github.com/apricote/releaser-pleaser">releaser-pleaser</a> 🤖</h4></summary>
|
||||
|
||||
If you want to modify the proposed release, add you overrides here. You can learn more about the options in the docs.
|
||||
|
||||
## Release Notes
|
||||
|
||||
### Prefix / Start
|
||||
|
||||
This will be added to the start of the release notes.
|
||||
|
||||
` + "```" + `rp-prefix
|
||||
` + "```" + `
|
||||
|
||||
### Suffix / End
|
||||
|
||||
This will be added to the end of the release notes.
|
||||
|
||||
` + "```" + `rp-suffix
|
||||
` + "```" + `
|
||||
|
||||
</details>
|
||||
`,
|
||||
wantErr: assert.NoError,
|
||||
want: testdata.MustReadFileString(t, "description-no-overrides.txt"),
|
||||
wantErr: assert.NoError,
|
||||
},
|
||||
{
|
||||
name: "existing overrides",
|
||||
changelogEntry: `## v1.0.0`,
|
||||
overrides: ReleaseOverrides{
|
||||
Prefix: "This release is awesome!",
|
||||
Suffix: "Fooo",
|
||||
Prefix: testdata.MustReadFileString(t, "prefix.txt"),
|
||||
Suffix: testdata.MustReadFileString(t, "suffix.txt"),
|
||||
},
|
||||
want: `<!-- section-start changelog -->
|
||||
## v1.0.0
|
||||
<!-- section-end changelog -->
|
||||
|
||||
---
|
||||
|
||||
<details>
|
||||
<summary><h4>PR by <a href="https://github.com/apricote/releaser-pleaser">releaser-pleaser</a> 🤖</h4></summary>
|
||||
|
||||
If you want to modify the proposed release, add you overrides here. You can learn more about the options in the docs.
|
||||
|
||||
## Release Notes
|
||||
|
||||
### Prefix / Start
|
||||
|
||||
This will be added to the start of the release notes.
|
||||
|
||||
` + "```" + `rp-prefix
|
||||
This release is awesome!
|
||||
` + "```" + `
|
||||
|
||||
### Suffix / End
|
||||
|
||||
This will be added to the end of the release notes.
|
||||
|
||||
` + "```" + `rp-suffix
|
||||
Fooo
|
||||
` + "```" + `
|
||||
|
||||
</details>
|
||||
`,
|
||||
want: testdata.MustReadFileString(t, "description-overrides.txt"),
|
||||
wantErr: assert.NoError,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue