gitlab-changelog-tool

Automatically generate changelogs from merge requests on GitLab.


License
BSD-3-Clause
Install
pip install gitlab-changelog-tool==1.0.2

Documentation

Releases Issues Pull requests License

GitLab Changelog Tool

Automatically generate changelogs from merge requests on GitLab.

GitLab Changelog Tool automatically creates changelogs by analyzing merge requests that have been merged since the latest tag for a specific branch. It utilizes a customizable template to generate the changelogs.

Template variables:

  • tag_name
  • tag_url
  • tag_timestamp
  • features
  • improvements
  • bug_fixes
# Changelog

## [{{ tag_name }}]({{ tag_url }}) ({{ tag_timestamp.strftime('%Y-%m-%d') }})
{% if features %}

### New features

{% for feature in features %}
- {{ feature }}
{% endfor %}
{% endif %}
{% if improvements %}

### Improvements

{% for improvement in improvements %}
- {{ improvement }}
{% endfor %}
{% endif %}
{% if bug_fixes %}

### Bug fixes

{% for bug_fix in bug_fixes %}
- {{ bug_fix }}
{% endfor %}
{% endif %}

The tool determines the release version and notes by inspecting the titles and labels of the merge requests:

Scoped labels:

  • type::feature
  • type::improvement
  • type::bugfix

Basic labels:

  • breakingchange

If no merge requests are available, a feature release is generated based on the project description.

The versioning scheme follows the Semantic Versioning (SemVer) specification.

Prerequisites

Installation

Production

Install package:

pip install gitlab-changelog-tool

Development

Install package:

pip install -e .[development]

Note Use the -e, --editable flag to install the package in development mode.

Note Set up a virtual environment for development.

Sort imports:

isort .

Format source code:

autopep8 --recursive --in-place .

Check static typing:

mypy .

Lint source code:

pylint setup.py gitlab_changelog_tool tests/

Test package:

pytest

Report test coverage:

pytest --cov

Hint See also the Makefile for development.

Usage

Generate changelog content:

gitlab-changelog-tool --project-id <project-id> generate

The command-line application will also retrieve configuration from specific environment variables:

  • CI_SERVER_URL
  • GITLAB_ACCESS_TOKEN
  • CI_PROJECT_ID

Copyright and license

Copyright (c) 2023, Danilo Peixoto Ferreira. All rights reserved.

Project developed under BSD-3-Clause License.