Skip to content

fix(gitlab): handle assignees and reviewers on issues and merge requests - #146

Merged
andrew merged 1 commit into
git-pkgs:mainfrom
abhinavgautam01:fix/142-gitlab-assignee-reviewer
Jul 26, 2026
Merged

fix(gitlab): handle assignees and reviewers on issues and merge requests#146
andrew merged 1 commit into
git-pkgs:mainfrom
abhinavgautam01:fix/142-gitlab-assignee-reviewer

Conversation

@abhinavgautam01

Copy link
Copy Markdown
Contributor

Fixes #142

Summary

Currently, creating or updating GitLab issues and Merge Requests does not set assignees or requested reviewers because the GitLab REST API requires numeric user IDs (int64), whereas forge options take string usernames ([]string).

This PR adds automatic username-to-ID resolution for GitLab, allowing opts.Assignees and opts.Reviewers to be set when creating or updating GitLab issues and Merge Requests.

Changes Made

  • gitlab/users.go: Added package-level resolveUserIDs helper function to resolve GitLab usernames to numeric user IDs via client.Users.ListUsers.
  • gitlab/issues.go:
    • Create: Resolved opts.Assignees to user IDs and set AssigneeIDs on CreateIssueOptions.
    • Update: Handled opts.Assignees updates on UpdateIssueOptions.
  • gitlab/prs.go:
    • Create: Resolved opts.Assignees and opts.Reviewers to user IDs and set AssigneeIDs & ReviewerIDs on CreateMergeRequestOptions.
    • Update: Handled opts.Assignees and opts.Reviewers updates on UpdateMergeRequestOptions.
  • gitlab/reviews.go: Refactored RequestReviewers to leverage resolveUserIDs.
  • Unit Tests:
    • Updated gitlab/issues_test.go and created gitlab/prs_test.go to cover issue & MR creation/updates with assignees and reviewers.

Verification

  • Ran go fmt ./... (All files formatted cleanly)
  • Ran go vet ./... (Passed with zero errors)
  • Ran go test -count=1 ./... (All package tests passed)

@andrew
andrew merged commit e16d87a into git-pkgs:main Jul 26, 2026
4 checks passed
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.

🐛 Handle assignee and reviewer for Gitlab

2 participants