Skip to content

GitLab Integration not returning username #1492

@nbelsterling

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.

Metadata

Metadata

Assignees

Labels

integrationRelated to remote integration

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions