Added README

This commit is contained in:
Marcel Kapfer 2021-05-26 23:35:02 +02:00
parent 649a817957
commit 417ac953d8
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

21
README.org Normal file
View file

@ -0,0 +1,21 @@
#+title: Changelog Tools
* Background
Our ([[https://gitlab.com/SvenPatrick][@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 [[https://gitlab.com/uulmhack/pipelines/auto-create-release][uulmhack/pipelines/auto-create-release]] project). The original implementation is/was based on the following simple one line shell command:
#+begin_src shell
git diff --unified=0 HEAD~1 ./CHANGELOG.md | tail -n +6 | sed -e "s/^+//"
#+end_src
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 [[https://gitlab.com/gitlab-org/release-cli/][gitlab-org/release-cli]] project which would require a rewrite using the Go programming language.
* Usage
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.
The =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.
The =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.