This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Marcel Kapfer 1490024510
Added Gitignore for Python
2021-05-26 23:36:05 +02:00
.gitignore Added Gitignore for Python 2021-05-26 23:36:05 +02:00
LICENSE Added LICENSE 2021-05-26 23:06:17 +02:00 Added README 2021-05-26 23:35:02 +02:00 Renamed files according to Python guidelines 2021-05-26 22:51:32 +02:00 Script for retrieving changelog between last two tags 2021-05-26 23:01:55 +02:00 Renamed files according to Python guidelines 2021-05-26 22:51:32 +02:00

Changelog Tools


Our (@SvenPatrick and my) fundamental idea is to create the changelog for a GitLab release automatically after pushing a Git tag using a GitLab CI pipeline (see also the uulmhack/pipelines/auto-create-release project). The original implementation is/was based on the following simple one line shell command:

git diff --unified=0 HEAD~1 ./ | tail -n +6 | sed -e "s/^+//"

This relies on the fact, that the file was touched in the last commit before tagging and does not handle multiple changed blocks well. The tools in this project try to provide a more general solution for this.

The (initial) Python implementation is only made as a proof-of-concept and as of now works for the tests I have run. The next, intermediate tasks for this would include (automatic) tests. In the long run the goal would be a merge request into the gitlab-org/release-cli project which would require a rewrite using the Go programming language.


The project currently consists of three scripts whereby can be seen as the main entry point. Nevertheless it is possible to run all three scripts on its own and also the do not have any dependencies besides itself and modules of the standard library. It is of course required to execute the files while being in a Git repository.

The returns a chronologically sorted list of templates in the current Git repository. takes two arguments specifying the old and the newer revision to diff between and an optional third argument to the file to diff (this defaults to The script returns the changes lines from the file between the two given revisions. Thereby the diff is filtered to exclude single line changes since it is assumed that these only contain typo fixes or other not noteworthy changes.

The finally combines the two scripts to output the relevant part of the changelog between the last two tags in the current Git repository.