Add additional attributes (variables) to the Gitlab Changelog
Proposal
I have recently came across the built-in feature in Gitlab to generate the changelog. Our company is thinking of integrating this to all of our projects as we believe this could be useful for us. I have spent a few week experimenting with Gitlab Changelog and I feel like there is not enough flexibility to adjust it for different needs.
Consider a default template for generating changelog:
---
template: |
{% if categories %}
{% each categories %}
### {{ title }}
{% each entries %}
- [{{ title }}]({{ commit.reference }}) \
{% if author.credit %} by {{ author.reference }}{% end %}
{% end %}
{% end %}
{% else %}
No changes.
{% end %}
Additional feature 1
For each entry, we would like to get a timestamp of when the commit was created or pushed to the repository. Something like that:
---
template: |
{% if categories %}
{% each categories %}
### {{ title }}
{% each entries %}
- [{{ title }}]({{ commit.reference }}) ({{ commit.created_at }}) \
{% if author.credit %} by {{ author.reference }}{% end %}
{% end %}
{% end %}
{% else %}
No changes.
{% end %}
Notice I have added attribute commit.created_at. Unfortunately, no such feature is available at the moment.
Additional feature 2
From what I understood, by default the glab changelog generate
will generate a list of changes since the last tag version till current tag version. And that is good. Whenever we do a release, we want to see what has changed since the last version.
Additionally, we would like to be able to generate a changelog since first tagged version till the latest tagged version and sort it by versions. For example, lets consider I have a project with 5 different versions (1.0.0, 1.1.0, 1.2.0, 1.3.0 and 1.4.0), my changelog would look something like this:
## 1.4.0
(2023-12-21)
### added
- something added
### removed
- some feature has been removed
### changed
- something has been changed.
## 1.3.0
(2023-12-15)
### added
- something added
- something else added
### removed
### changed
## 1.2.0
(2023-12-12)
### added
### removed
- some feature has been removed
### changed
- something has been changed.
## 1.1.0
(2023-12-05)
### added
### removed
- some feature has been removed
### changed
- something has been changed.
## 1.0.0
(2023-12-02)
### added
### removed
- some feature has been removed
### changed
- something has been changed.
I am aware that you can generate 5 different changelogs by using -to
and -from
attributes and then stitching them all together but you need to know all commit hashes and that is very inconvenient. It would be much easier if Gitlab could do this automatically on his own. For example, if I tell gitlab something like:
glab changelog generate --to 1.5.0 --from 1.0.0
it could automatically find the start and end by looking up the tagged commits .