Skip to content

fix(gitlab): resolve commit author usernames from API#1540

Closed
leno23 wants to merge 1 commit into
orhun:mainfrom
leno23:fix-gitlab-username-1492
Closed

fix(gitlab): resolve commit author usernames from API#1540
leno23 wants to merge 1 commit into
orhun:mainfrom
leno23:fix-gitlab-username-1492

Conversation

@leno23

@leno23 leno23 commented May 25, 2026

Copy link
Copy Markdown

Summary

  • GitLab's commits API returns author_name (display name) rather than a username, so changelogs showed @Nathan Belsterling instead of @nbelste1.
  • Resolve usernames after fetching commits by:
    1. Mapping merge commit SHAs to merge request author usernames
    2. Looking up remaining authors via project members (/members/all?query=email) and user search fallback
  • Store the resolved value in GitLabCommit.resolved_username and use it for commit.gitlab.username template variables.

Fixes #1492

Test plan

  • cargo test -p git-cliff-core --features gitlab gitlab
  • Added unit tests for resolved username, MR mapping, and members URL encoding
  • GitLab integration fixture (test-gitlab-integration) in CI

GitLab's commits API returns display names in author_name, not usernames.
Resolve usernames via merge request authors and project member email lookup
before populating changelog template variables.

Fixes #1492

Co-authored-by: Cursor <cursoragent@cursor.com>
@leno23 leno23 requested a review from orhun as a code owner May 25, 2026 06:38
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 34.16667% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.67%. Comparing base (7e35ff5) to head (623e0db).

Files with missing lines Patch % Lines
git-cliff-core/src/remote/gitlab.rs 26.39% 53 Missing ⚠️
git-cliff-core/src/changelog.rs 45.84% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1540      +/-   ##
==========================================
- Coverage   48.63%   47.67%   -0.96%     
==========================================
  Files          26       26              
  Lines        2287     2373      +86     
==========================================
+ Hits         1112     1131      +19     
- Misses       1175     1242      +67     
Flag Coverage Δ
unit-tests 47.67% <34.17%> (-0.96%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@orhun orhun closed this May 25, 2026
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.

GitLab Integration not returning username

3 participants