shipkit / shipkit-changelog

Minimalistic Gradle plugin that generates changelog based on commit history and GitHub pull requests/issues
Apache License 2.0
68 stars 10 forks source link

Possibility to customize changelog format #23

Open mstachniuk opened 4 years ago

mstachniuk commented 4 years ago

Current changelog format is good for Open Source project. However for non-OSS is not important who and how much commit. And other customizations should be possible like header, footer, date format. See: https://github.com/mockito/shipkit/issues/370

The implementation may create a JSON file as mid step then everyone can generate whatever is needed.

mockitoguy commented 4 years ago

I'd like to see customers asking for it first ;-) I'd like to avoid complexity and evolving the plugin into something that is hard to maintain. My experience with offering "configuration" for formatting that it is a never-ending story of expanding the configuration to support more formatting use cases.

The implementation may create a JSON file as mid step then everyone can generate whatever is needed.

This would be my preference.

Thanks for reporting!

beatngu13 commented 2 years ago

We at JUnit Pioneer would also appreciate customization to a certain degree:

https://github.com/junit-pioneer/junit-pioneer/issues/622

Similar to GitHub's release notes generator, it would helpful to filter tags and create categories. Here is an example configuration:

# .github/release.yml

changelog:
  exclude:
    labels:
      - ignore-for-release
    authors:
      - octocat
  categories:
    - title: Breaking Changes 🛠
      labels:
        - Semver-Major
        - breaking-change
    - title: Exciting New Features 🎉
      labels:
        - Semver-Minor
        - enhancement
    - title: Other Changes
      labels:
        - "*"

Do you have any plans for such customization options?

LunNova commented 2 years ago

In the short term, a custom changelog task works: https://github.com/MinimallyCorrect/DefaultsPlugin/blob/main/src/main/java/dev/minco/gradle/changelog/ChangelogTask.java

// task linked above already registered as mincoGenerateChangelog

tasks.named("mincoGenerateChangelog") {
    version.value("" + project.version)
    githubUrl.value(project.ext["githubUrl"] as String)
    outputFile.fileValue(project.file("$buildDir/changelog.md"))
    fromRevision.value(project.ext["shipkit-auto-version.previous-tag"] as String)
}

tasks.named("githubRelease") {
    def genTask = tasks.named("mincoGenerateChangelog").get()
    dependsOn(genTask)
    repository = project.ext["githubOwnerProject"] as String
    changelog = genTask.outputFile.get().getAsFile()
    newTagRevision = System.getenv("GITHUB_SHA")
    githubToken = System.getenv("GITHUB_TOKEN")
}