diff --git a/src/ToCloneUrl.php b/src/ToCloneUrl.php index f3f0872..d29bb2c 100644 --- a/src/ToCloneUrl.php +++ b/src/ToCloneUrl.php @@ -50,6 +50,11 @@ public static function fromRepoAndToken(string $repo, string $authToken) : strin $repo_parsed["path"] ); break; + + case 'www.gitlab.com': + case 'gitlab.com': + $repo_path = sprintf('https://oauth2:%s@gitlab.com%s', $authToken, $repo_parsed["path"]); + break; } } } diff --git a/tests/UnitTest.php b/tests/UnitTest.php index 5eeab97..c2107db 100644 --- a/tests/UnitTest.php +++ b/tests/UnitTest.php @@ -49,6 +49,16 @@ public static function provideAllCases() : array 'token123', 'https://x-access-token:token123@github.com/user/repo.git', ], + [ + 'https://gitlab.com/user/repo.git', + 'token123', + 'https://oauth2:token123@gitlab.com/user/repo.git', + ], + [ + 'https://www.gitlab.com/user/repo.git', + 'token123', + 'https://oauth2:token123@gitlab.com/user/repo.git', + ], ]; } }