Import GitHub project and all (known) forks
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Description
Importing a project from GitHub that has pull requests from forks will currently create a new merge request using the pull/{id}/head branch name. This is great for keeping the history and a list of the changes but it does mean that any existing open pull requests will need to be closed and re-opened again after the import to GitLab.
In an ideal world this would instead re-create the forked project under the user account of the original submitter.
Proposal
Recreating another users fork would mean that any import could potentially cause lots of import jobs to start, one for each fork that we could recreate. The imports would also need to be done in a strict order (you need to make sure that all forks have their commits imported first since there maybe cross-fork PRs that could end up in a cyclic loop).
There's also possible issues with perceived security since it would allow 1 user to create projects under another users account. To limit this I think only recreating forks for people that are a member of the group would be sufficient (this would prevent e.g. the Laravel framework from creating 1000s of forks for people that don't want them but would allow the project to let team members know that it will happen).
For this to happen users would also need to have linked their GitHub account to their GitLab account (similar to what is needed now to attribute comments/MRs to existing users).
I see this working something like:
- Import initial project source
- Get a list of all forks using the GitHub Fork API
- Filter list to members of group that have linked GitHub accounts
- Create fork and import source
At this point it should be able to process each forks import as normal, creating labels, issues and MRs. Once all the forks have been imported then the main projects import can continue as normal. For both the main import and all forks, if a MR branch doesn't exist then the fork can be asked to create it, or for forks that don't exist it can carry on as it currently does and create the pull/{id}/head branch.