(Ko)tlin (cha)ngelog (Mer)ge script
This script collects all markdown based changelog files in a given folder and inserts them into an existing CHANGELOG.md
.
It's used for Git workflows with separated changelog entries to avoid merge conflicts.
Each story/branch can provide its own mini-changelog. And before a release you can easily merge them together.
In addition it supports public
and private
sections.
This script has no dependencies and doesn't need gradle or maven to run.
We maintain our changelog for our product in the git repository next to the code.
Every branch is based on a user story with a corresponding log entry.
The changelog is one big file with the newest entry in the first line, the CHANGELOG.md
.
Now whenever we merge different branches together, merge conflicts are almost inevitable.
Even the CHANGELOG merge=union
didn't help to resolve these conflicts automatically.
Provide for every story/branch a separate changelog file named by the Jira Task (e.g. S-4203.md
).
Merge branches easily without any conflicts on a changelog.
Before tag and release of the master branch run the kochamer.kt
script to:
- Read all changelog files in a given folder.
- Group them by
public
andprivate
sections. - Add missing task identifiers based on the filename.
- Generate a release title based on the current date.
- Insert the new changelog entry into the existing
CHANGELOG.md
. - Delete all merged changelog files.
Just configure the scripts vals on top. To run it as Kotlin Script you can change the file extions to .kts
and add the missing main()
call.
Alternatively download the latest script release.
Consider three files in the folder \changelog
and our existing CHANGELOG.md
in the main dir:
CHANGELOG.md
# 2018.01 of 05.01.2018
## public:
* Added stardust to the login screen. [S-4101]
* Added cookie based auto login. [S-4100]
* ....
changelog/S-4201.md
public:
* We added a tin opener in the tools section, yeah!
private:
* Added an admin function to use the tin opener to view on private user data.
changelog/S-4203.md
private: * Fixed the bug which allowed user with umlauts in their names to login without password.
changelog/S-4207.md
public: * The chat now supports the unicorn emoji.
private: * Removed the middle-finger emoji.
After running kochamer.kt
the CHANGELOG.md
will be:
# 2018.04 of 26.01.2018
## public:
* We added a tin opener in the tools section, year! [S-4201]
* The chat now supports the unicorn emoji. [S-4207]
## private:
* Added an admin function to use the tin opener to view on private user data. [S-4203]
* Fixed the bug which allowed user with umlauts in their names to login without password. [S-4203]
* Removed the middle-finger emoji. [S-4207]
# 2018.01 of 05.01.2018
## public:
* Added stardust to the login screen. [S-4101]
* Added cookie based auto login. [S-4100]
* ....
View the KochamerTest for details.
- How can I run 'Kochamer'?
Run it from IntelliJ with right-click run/Kochamer.TK - Can I change the date formatter?
Yes, seelocale = Locale.GERMAN
- Kochamer isn't a real Kotlin script, right?
Yes, it is simple Kotlin code. You can change the file extension to.kts
to run it as a script. But this way you don't have the option to debug or test the code.
For a prebuilt script look for the releases.