Skip to content

Unable to run changelog method in script plugins #211

@KorewaLidesu

Description

@KorewaLidesu

Describe the bug
Unable to run changelog method in script plugins.
If the code below put in build.gradle then it will work, but if won't on script plugin.

I can't reload with --stacktrace arguments. So here is the other option I have

Code:

private String parseChangelog() {
    if (propertyBool('publish_with_changelog')) {
        if (!file('CHANGELOG.md').exists()) {
            throw new GradleException('publish_with_changelog is true, but CHANGELOG.md does not exist in the workspace!')
        }
        String parsedChangelog =
            changelog.renderItem(
                    changelog.getLatest().withHeader(false).withEmptySections(false),
                    Changelog.OutputType.MARKDOWN)
        if (parsedChangelog.isEmpty()) {
            throw new GradleException('publish_with_changelog is true, but the changelog for the latest version is empty!')
        }
        return parsedChangelog
    }
    return null
}

To Reproduce
Reload project.

Expected behavior
Changelog should be printed.

Environment:

  • OS: Window
  • Gradle Changelog Plugin Version: 2.2.0
  • Gradle Version: 8.3

Additional context
No infos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions