Add support for gitlab @@role codeowner syntax #44620
Replies: 1 comment
|
PR welcome |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
GitLab supports the
@@rolesyntax in its CODEOWNERS specification (e.g.@@developer,@@maintainer,@@owner), which lets you assign a code owner by project role rather than by a specific user or group. See the GitLab docs.Currently, with
"assigneesFromCodeOwners": true, when Renovate reads these entries out of CODEOWNERS and tries to resolve reviewers/assignees,expandGroupMembersdoesn't recognise the@@rolesyntax. It strips the leading@and passes the remainder (e.g.@developer) to the GitLab groups API as if it were a group name. No such group exists, so the request returns a404and the intended reviewers are never assigned.I have
implementedAI slopped (but it passes my personal review 😄 ) a fix together if it would be of interest to the project. I have not run it against a real repo, only relied on unit tests. I'm happy to give that a bash if it's a requirement.The fix simply detects
@@rolehandles inexpandGroupMembersbefore the group-expansion path. When a handle maps to a known GitLab role it resolves it to the project's members at that access level (via the project members API, filtered client side byaccess_levelas the API does not support such a filter) and expands to their usernames. This mirrors how group handles are expanded to their members. Handles that aren't recognised roles continue through the existing group/user logic unchanged.All reactions