Skip to content

GitLab Integration not returning username #1492

Description

@nbelsterling

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When generating the Changelog for a repository using the GitLab integration, the commit author is used instead of the GitLab username. This behavior is unexpected and goes against the current GitLab Integration documentation.

Steps To Reproduce

To reproduce this bug:

  1. Setup a GitLab project to use git-cliff:
    [remote.gitlab]
    owner = "nbelste1"
    repo = "git-cliff-example"
    

    Example: https://gitlab.com/nbelste1/git-cliff-example/-/blob/feature/init/cliff.toml

  2. Set up a GitLab CI/CD pipeline job to run using the integration

    Example: https://gitlab.com/nbelste1/git-cliff-example/-/blob/feature/init/.gitlab-ci.yml

  3. Make commits authored by your GitLab account credentials (same email)

    Example: https://gitlab.com/nbelste1/git-cliff-example/-/commit/65cd6548a62a7d1e6c573726d6a358b0e0521061

  4. Review the Changelog generated by git-cliff -r .
    ## What's Changed
    * initial README by @Nathan Belsterling
    * git-cliff setup
    
    ### New Contributors
    * @Nathan Belsterling made their first contribution
    
    <!-- generated by git-cliff -->
    

    Source: https://gitlab.com/nbelste1/git-cliff-example/-/jobs/14090146226/artifacts/file/CHANGELOG.md

Expected behavior

The following Changelog is generated:

## What's Changed
* initial README by @nbelste1
* git-cliff setup

### New Contributors
* @nbelste1 made their first contribution

<!-- generated by git-cliff -->

Screenshots / Logs

You can see that GitLab properly recognized commit 65cd6548a62a7d1e6c573726d6a358b0e0521061 as authored by a GitLab user below:
Image

Software information

  • Operating system: Debian GNU/Linux 12.12 (bookworm)
  • Rust version: N/A (Rust not included in official Docker image)
  • Project version: git-cliff 2.12.0

Used the official orhun/git-cliff Docker image

Additional context

After some investigation, it appears the GitLab commits API and GitHub commit API differ slightly in their response which git-cliff-core/src/remote/gitlab.rs doesn't properly account for. The GitHub commit API includes the author and committer while the GitLab commits API doesn't (and requires an additional API call). Rather than making the additional call, git-cliff-core/src/remote/gitlab.rs just places the commit.author.name in the remote.username field.

Activity

  1. welcome commented on Apr 25, 2026

    @welcome

    Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

  2. orhun commented on Apr 25, 2026

    @orhun
    Owner

    Thanks for reporting!

    Rather than making the additional call, git-cliff-core/src/remote/gitlab.rs just places the commit.author.name in the remote.username field.

    Hmm, do you think that's the cause? Does GitLab API return anything that is relevant (i.e. any other fields that we can use for this)?

  3. nbelsterling commented on Apr 26, 2026

    @nbelsterling
    ContributorAuthor

    @orhun that’s my assessment from my limited knowledge of Rust. I haven’t found a single GitLab REST API call that returns a similar result as GitHub for commits. GitLab does support GraphQL which could be used instead of REST to get results in a single call. Otherwise, I believe multiple API calls would required to replicate GitHub’s functionality and allow for direct GitLab user mentions in Changelogs.

  4. removed their assignment
    on Jul 13, 2026
  5. royporter-cf commented on Aug 14, 2026

    @royporter-cf

    Can confirm this on git-cliff 2.13.1 — and it's worth noting that the issue persists even when a commit is successfully matched to an MR.

    Here's git cliff --context output for a commit where pr_number is populated:

    {
      "message": "jira links fix",
      "author": {
        "name": "Flapjack McButterpants",
        "email": "flapjack@example.com"
      },
      "gitlab": {
        "username": "Flapjack McButterpants",
        "pr_title": "feat: jira links fix",
        "pr_number": 15,
        "pr_labels": [],
        "is_first_time": false
      }
    }

    The actual GitLab username is flapjack.mcbutterpants_42, but gitlab.username contains the git display name even though the MR was matched.

    This suggests the fix doesn't necessarily require an extra API call — GitLabMergeRequest.author.username already contains the correct value (it's fetched as part of the MR response). It just needs to be propagated to the commit's remote.username field for matched commits.

    For commits that can't be matched to an MR, a fallback to the Users API (/users?search=<email>) would still be needed.

  6. orhun commented on Aug 22, 2026

    @orhun
    Owner

    #1613 might be related: we're adding a new field called pr_author

    username is resolved from the commit author, whereas pr_author is the account that
    opened the pull request. They can differ, so a template that wants to credit the
    contributor rather than whoever the commit resolves to can prefer pr_author:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededintegrationRelated to remote integration

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions