|Marcel Kapfer 1490024510||2 years ago|
|.gitignore||2 years ago|
|LICENSE||2 years ago|
|README.org||2 years ago|
|changelog_diff.py||2 years ago|
|latest_changelog.py||2 years ago|
|latest_tags.py||2 years ago|
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 ./CHANGELOG.md | tail -n +6 | sed -e "s/^+//"
This relies on the fact, that the
CHANGELOG.md 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
latest_changelog.py 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.
latest_tags.py returns a chronologically sorted list of templates in the current Git repository.
changelog_diff.py 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
CHANGELOG.md). 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.
latest_changelog.py finally combines the two scripts to output the relevant part of the changelog between the last two tags in the current Git repository.