mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 21:21:03 +00:00
feat: less repetitive entries for for prerelease changelogs
Right now we always show all new releasable commits since the last _stable_ release. If a project publishes multiple pre-releases in a row, they all repeat the same lines with a few new additions. On the other hand, when we cut a stable release, we do want to show all changes since the last stable release, as we can not expect users to read the changelog of pre-releases. As a compromise, the code now looks at the type of release that is being created, and decides based on that if we will look at STABLE..HEAD (stable release) or LATEST..HEAD (pre-release). Close #33
This commit is contained in:
parent
693ca21e32
commit
4c332b32d3
2 changed files with 22 additions and 4 deletions
16
releasepr.go
16
releasepr.go
|
|
@ -59,9 +59,8 @@ func NewReleasePullRequest(head, branch, version, changelogEntry string) (*Relea
|
|||
}
|
||||
|
||||
type ReleaseOverrides struct {
|
||||
Prefix string
|
||||
Suffix string
|
||||
// TODO: Doing the changelog for normal releases after previews requires to know about this while fetching the commits
|
||||
Prefix string
|
||||
Suffix string
|
||||
NextVersionType NextVersionType
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +91,17 @@ func (n NextVersionType) String() string {
|
|||
}
|
||||
}
|
||||
|
||||
func (n NextVersionType) IsPrerelease() bool {
|
||||
switch n {
|
||||
case NextVersionTypeRC, NextVersionTypeBeta, NextVersionTypeAlpha:
|
||||
return true
|
||||
case NextVersionTypeUndefined, NextVersionTypeNormal:
|
||||
return false
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Label is the string identifier of a pull/merge request label on the forge.
|
||||
type Label string
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,15 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
|
|||
logger.InfoContext(ctx, "no latest tag found")
|
||||
}
|
||||
|
||||
releasableCommits, err := rp.forge.CommitsSince(ctx, releases.Stable)
|
||||
// By default, we want to show everything that has happened since the last stable release
|
||||
lastReleaseCommit := releases.Stable
|
||||
if releaseOverrides.NextVersionType.IsPrerelease() {
|
||||
// if the new release will be a prerelease,
|
||||
// only show changes since the latest release (stable or prerelease)
|
||||
lastReleaseCommit = releases.Latest
|
||||
}
|
||||
|
||||
releasableCommits, err := rp.forge.CommitsSince(ctx, lastReleaseCommit)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue