Skip to content

feat(examples): add GitLab built-in changelog templates#1561

Open
JDanRibeiro wants to merge 2 commits into
orhun:mainfrom
JDanRibeiro:feat/gitlab-example-templates
Open

feat(examples): add GitLab built-in changelog templates#1561
JDanRibeiro wants to merge 2 commits into
orhun:mainfrom
JDanRibeiro:feat/gitlab-example-templates

Conversation

@JDanRibeiro

@JDanRibeiro JDanRibeiro commented Jun 17, 2026

Copy link
Copy Markdown

Description

Adds two built-in GitLab changelog templates under examples/:

  • gitlab.toml — release notes format tailored for GitLab Releases (merge request links, contributors, tag links)
  • gitlab-keepachangelog.toml — detailed Keep a Changelog-style format with GitLab commit and merge request links

Also updates the documentation:

  • website/docs/usage/initializing.md — lists the new templates for --init and --config
  • website/docs/integration/gitlab.md — adds a "GitLab Changelog" section with usage examples
  • website/docs/templating/examples.md — adds rendered previews for both GitLab templates

Motivation and Context

GitLab integration has been supported since v2.3.0, but there were no official built-in templates equivalent to github.toml and github-keepachangelog.toml. This makes it harder for GitLab users to get started with --init / built-in --config names.

Closes #1560

How Has This Been Tested?

  • cargo build (templates are embedded via BuiltinConfig)
  • git cliff --init gitlab generates cliff.toml from the new template
  • git cliff --config gitlab --dry-run loads the built-in template
  • git cliff --config gitlab-keepachangelog --dry-run loads the detailed template
  • cargo test passes

Environment: git-cliff built from source with the gitlab feature enabled.

Screenshots / Logs (if applicable)

N/A

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly (if applicable).
  • I have formatted the code with rustfmt.
    • cargo +nightly fmt --all — N/A (no Rust changes)
  • I checked the lints with clippy.
    • cargo clippy --tests --verbose -- -D warnings — N/A (no Rust changes)
  • I have added tests to cover my changes. — N/A (follows existing example template pattern)
  • All new and existing tests passed.
    • cargo test

@JDanRibeiro JDanRibeiro requested a review from orhun as a code owner June 17, 2026 01:07

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the PR, looks great! just have some suggestion for improving it

Comment thread examples/gitlab.toml

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be some issues with formatting, can you look into it?

e.g. I tried:

$ cargo run -- -c examples/gitlab.toml --gitlab-repo filipriec/tui-pages -u
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.44s
     Running `target/debug/git-cliff -c examples/gitlab.toml --gitlab-repo filipriec/tui-pages -u`
## What's Changed
### Bug Fixes

* handle nested annotated tags
* move heart emoji before "New Contributors" heading
* link to correct release notes
* ignore missing git objects
### Features

* add GitLab built-in changelog templates
* add no_increment_regex config<!-- generated by git-cliff -->

(there is no newline before footer)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem identified and corrected.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the ! prefix for the GitLab MR references? That's what we do in the other template :)

e.g.

- Ignore missing git objects (#1523) ([4377363](https://gitlab.com/filipriec/tui-pages/-/commit/437736385b66057cdb138f08a4bbb7a4f0424adf))

I think that should be !1523, right?


## GitLab Changelog

If you would like to create release notes tailored for GitLab, you can use the [`gitlab.toml`](https://github.com/orhun/git-cliff/tree/main/examples/gitlab.toml) example.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can mention the other template file (detailed) as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, correction made.

Comment thread website/docs/usage/initializing.md Outdated
Comment on lines +38 to +39
- [`gitlab.toml`](https://github.com/orhun/git-cliff/tree/main/examples/gitlab.toml): release notes format tailored for GitLab Releases.
- [`gitlab-detailed.toml`](https://github.com/orhun/git-cliff/tree/main/examples/gitlab-detailed.toml): detailed changelog with GitLab commit and merge request links.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we remove the detailed template and just add keepachangelog one, just to be aligned with the GitHub template as well?

i.e. let's have gitlab and gitlab-keepachangelog :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The applied standard really makes a lot of sense.

Comment thread examples/gitlab-detailed.toml Outdated
{% macro print_commit(commit) -%}
- {% if commit.breaking %}**BREAKING:** {% endif %}{{ commit.message | split(pat="\n") | first | upper_first | trim }} \
([{{ commit.id | truncate(length=7, end="") }}]({{ self::project_url() }}/-/commit/{{ commit.id }}))\
{%- if commit.remote.pr_number %} in [!{{ commit.remote.pr_number }}]({{ self::project_url() }}/-/merge_requests/{{ commit.remote.pr_number }}){%- endif -%}\

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior was replicated, as shown in lines 44 and 67.
#1561 (comment)

- Fix missing newline before footer in gitlab.toml (unreleased output)
- Rename gitlab-detailed.toml to gitlab-keepachangelog.toml
- Use ! prefix for MR references and strip (orhun#123) from commit messages
- Update docs (initializing, integration, templating examples)
@JDanRibeiro JDanRibeiro force-pushed the feat/gitlab-example-templates branch from 7249193 to 9888ee5 Compare June 25, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request add GitLab built-in changelog templates

2 participants