Import GitHub repository Collaborators with custom role as GitLab project members
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
General
It's the expanding of Import GitHub repository Collaborators as GitLab project members. Base issue covered basic GitHub roles: Read, Triage, Write, Maintain, Admin. This issue is to import collaborators with custom GitHub roles.
Problem to solve
All custom roles on GitHub side are inherited from basic roles that we need to already have been imported before starting this task: Read, Triage, Write, Maintain, Admin.
From GitHub docs:
A custom repository role is a configurable set of permissions with a custom name you choose. For more information, see "Managing custom repository roles for an organization.
What means that we have basic role + an array of additional permissions that we need somehow to map.
NOTE: the list with additional permissions has an API endpoint too.
Proposed solution
Most likely that each collaborator with custom role will have next payload:
"permissions": {
"pull": true,
"triage": true,
"push": true,
"maintain": false,
"admin": false
},
"role_name": "Custom Role"
What means that this role is inherited from the basic "Write" role without any details about additional permissions and we need to do one more request to fetch custom role to know which of additional permissions this role includes to map it with additional permissions that we have on GitLab side.
WARN: Currently (2023-03-12) GitLab doesn't support customizable roles. What leads us to the next possible solutions:
- Keep it as it is. What means partial import for the user in cases when any collaborator with custom role present. Other collaborators with non-custom roles are continuing to be imported by basic issue.
- Wait and try to map GitHub additional permissions with GitLab additional permissions when this feature get released on GitLab.
- Map custom roles as their basic role without additional permissions. From the cons - it could be stressful for an admin to do post-import work with finding users that needs to be promoted to higher role in case if basic isn't enough.