Skip to main content

Idea

The problem I want to solve

Let me introduce a few conventions I follow on my GH projects:

At this point, the problem I have is cangulo.nuke.releasecreator doesn't document the changes introduced on every release.

Changes

I consider any commit message as fix: Solved bug in the TransactionsController a change introduced. My goal is to have them in:

  1. The GH release notes on every version released, example.
  2. The Changelog, this a Markdown file where all the changes are listed and grouped per version. example
    1. File name: changelog.md (simple, right?)
    2. Order: recent notes at the top

Approach

I decided to implement a NuGet package to be consumed by cangulo.nuke.releasecreator. Here are the main reasons:

  • Although MD is easy to write, it requires some formatting when creating elements (# for headers, * for lists, etc).
  • To code a solution based on shell scripts seems to be an option, but the release notes should be defined in cangulo.nuke.releasecreator. This is because the release is created through the GH API there.
  • Implementing a solution directly in cangulo.nuke.releasecreator would mix domains. Changes in the changelog format should not affect the release process.

The nuget package is: cangulo.changelog

I have the following features in mind:

  • Group changes per commit type
  • Every change should be listed with a bullet point
  • Every Release will be written as an MD Header (#)
  • Every release should have its date
  • Future elements as contributors, PR link, Link to the tests reports executed. Yes, I'm going too far, I will keep this for future versions ๐Ÿ˜„

Examples

Let me give an example of the input and output expected.

Input: Commits from a merged PR

The release 0.0.2 is created after merging a PR with the next commits list:

  • fix: Solved bug in the TransactionsController
  • refactor: Simplified Transactions Repository
  • docs: Updated docs/examples
  • feat: Implemented new DocumentsController
  • refactor: It's possible! You can turn a 50-line code chunk into just 3 lines. Here's how -> Please never write a commit message like this ๐Ÿ˜œ, you can find more funny messages here.

Output: Changelog Updated

Next is the changelog section I would like to have for version 0.0.2:

# 0.0.2

2021-11-20

fix:
- Solved bug in the TransactionsController

refactor:
- Simplified Transactions Repository
- It's possible! You can turn a 50-line code chunk into just 3 lines. Here's how

docs:
- Updated docs/examples

features:
- Implemented new DocumentsController

Please note the commits are grouped by type: fix, refactor, docs

Non Conventional Commits

I also would like to accept non conventional commits. The only difference would be commits won't be grouped.

info
Output for non conventional commits
# 0.0.2

2021-11-20

* fix: Solved bug in the TransactionsController
* refactor: Simplified Transactions Repository
* docs: Updated docs/examples
* feat: Implemented new DocumentsController
* refactor: It's possible! You can turn a 50-line code chunk into just 3 lines. Here's how

Did you like it? Share It!