git-cliff
git-cliff copied to clipboard
Make related issue number and username available for GitLab integration
Discussed in https://github.com/orhun/git-cliff/discussions/1103
Originally posted by lfvjimisola March 20, 2025 Read up on: https://git-cliff.org/docs/integration/gitlab
Looking at the JSON output I'm wondering if it would be possible to add:
- a potentially related issue_number
- userid (not username, e.g. @orhun @lfvjimisola)
Here are some example responses from the GitLab API:
Commit:
[
{
"id":"70db916eb98ce4777c7ca57de1bc88685ee6bc26",
"short_id":"70db916e",
"created_at":"2025-03-13T17:27:12.000+00:00",
"parent_ids":[
"f33acbfa8e6cae4ceec2e8965c31830ce16ffee0",
"673f283726e6892595ec3d0510a15f7ef97fb300"
],
"title":"Merge pull request #1 from dark0dave/feature/nixosUpdates",
"message":"Merge pull request #1 from dark0dave/feature/nixosUpdates\n\nfeat(nixos): Updates from nixos",
"author_name":"dark0dave",
"author_email":"[email protected]",
"authored_date":"2025-03-13T17:27:12.000+00:00",
"committer_name":"GitHub",
"committer_email":"[email protected]",
"committed_date":"2025-03-13T17:27:12.000+00:00",
"trailers":{
},
"extended_trailers":{
},
"web_url":"https://gitlab.com/dark0dave/dotfiles/-/commit/70db916eb98ce4777c7ca57de1bc88685ee6bc26"
},
]
Merge request:
[
{
"id":214177566,
"iid":20,
"project_id":7283906,
"title":"feat(rtx): One version manager to bring them all, and in the darkness bind them",
"description":"Signed-off-by: dark0dave \[email protected]\u003e",
"state":"merged",
"created_at":"2023-03-29T01:54:05.056Z",
"updated_at":"2023-03-29T02:09:52.269Z",
"merged_by":{
"id":2520934,
"username":"dark0dave",
"name":"dark0dave",
"state":"active",
"locked":false,
"avatar_url":"https://gitlab.com/uploads/-/system/user/avatar/2520934/avatar.png",
"web_url":"https://gitlab.com/dark0dave"
},
"merge_user":{
"id":2520934,
"username":"dark0dave",
"name":"dark0dave",
"state":"active",
"locked":false,
"avatar_url":"https://gitlab.com/uploads/-/system/user/avatar/2520934/avatar.png",
"web_url":"https://gitlab.com/dark0dave"
},
"merged_at":"2023-03-29T02:09:51.824Z",
"closed_by":null,
"closed_at":null,
"target_branch":"master",
"source_branch":"feature/rtx",
"user_notes_count":0,
"upvotes":0,
"downvotes":0,
"author":{
"id":2520934,
"username":"dark0dave",
"name":"dark0dave",
"state":"active",
"locked":false,
"avatar_url":"https://gitlab.com/uploads/-/system/user/avatar/2520934/avatar.png",
"web_url":"https://gitlab.com/dark0dave"
},
"assignees":[
{
"id":2520934,
"username":"dark0dave",
"name":"dark0dave",
"state":"active",
"locked":false,
"avatar_url":"https://gitlab.com/uploads/-/system/user/avatar/2520934/avatar.png",
"web_url":"https://gitlab.com/dark0dave"
}
],
"assignee":{
"id":2520934,
"username":"dark0dave",
"name":"dark0dave",
"state":"active",
"locked":false,
"avatar_url":"https://gitlab.com/uploads/-/system/user/avatar/2520934/avatar.png",
"web_url":"https://gitlab.com/dark0dave"
},
"reviewers":[
{
"id":2520934,
"username":"dark0dave",
"name":"dark0dave",
"state":"active",
"locked":false,
"avatar_url":"https://gitlab.com/uploads/-/system/user/avatar/2520934/avatar.png",
"web_url":"https://gitlab.com/dark0dave"
}
],
"source_project_id":7283906,
"target_project_id":7283906,
"labels":[
],
"draft":false,
"imported":false,
"imported_from":"none",
"work_in_progress":false,
"milestone":null,
"merge_when_pipeline_succeeds":false,
"merge_status":"can_be_merged",
"detailed_merge_status":"not_open",
"merge_after":null,
"sha":"cb8c0542a92ff6a51abdfcbab91de4fdf5695e96",
"merge_commit_sha":"4c55cd75b764cf32f3519420cfe0565f5a76bea2",
"squash_commit_sha":null,
"discussion_locked":null,
"should_remove_source_branch":true,
"force_remove_source_branch":true,
"prepared_at":"2023-03-29T01:54:07.084Z",
"reference":"!20",
"references":{
"short":"!20",
"relative":"!20",
"full":"dark0dave/dotfiles!20"
},
"web_url":"https://gitlab.com/dark0dave/dotfiles/-/merge_requests/20",
"time_stats":{
"time_estimate":0,
"total_time_spent":0,
"human_time_estimate":null,
"human_total_time_spent":null
},
"squash":false,
"squash_on_merge":false,
"task_completion_status":{
"count":0,
"completed_count":0
},
"has_conflicts":false,
"blocking_discussions_resolved":true,
"approvals_before_merge":null
},
]
a potentially related issue_number
We can probably use the references field for that.
userid
Probably we want e.g. "id":2520934