|
|
@ -17,6 +17,9 @@ const downloadRepo = async repoPath => { |
|
|
|
const ref = pathParts.ref ? `?ref=${pathParts.ref}` : '' |
|
|
|
url = `https://gitlab.com/${pathParts.main}/repository/archive.tar` + ref |
|
|
|
break |
|
|
|
case 'Bitbucket': |
|
|
|
url = `https://bitbucket.org/${pathParts.main}/get/${pathParts.ref || 'master'}.zip` |
|
|
|
break |
|
|
|
default: |
|
|
|
url = `https://api.github.com/repos/${pathParts.main}/tarball/${pathParts.ref}` |
|
|
|
} |
|
|
@ -44,7 +47,13 @@ const downloadRepo = async repoPath => { |
|
|
|
} |
|
|
|
|
|
|
|
const capitalizePlatform = name => { |
|
|
|
return name.replace('github', 'GitHub').replace('gitlab', 'GitLab') |
|
|
|
const names = { |
|
|
|
github: 'GitHub', |
|
|
|
gitlab: 'GitLab', |
|
|
|
bitbucket: 'Bitbucket' |
|
|
|
} |
|
|
|
|
|
|
|
return names[name] |
|
|
|
} |
|
|
|
|
|
|
|
const splittedURL = fullURL => { |
|
|
@ -62,9 +71,12 @@ const splittedURL = fullURL => { |
|
|
|
// Assign Git reference
|
|
|
|
let ref = pathParts.length >= 2 ? pathParts[1] : '' |
|
|
|
|
|
|
|
// Shorten SHA for commits
|
|
|
|
if (pathParts[0] && pathParts[0] === 'commit') { |
|
|
|
ref = ref.substring(0, 7) |
|
|
|
// Firstly be sure that we haven know the ref type
|
|
|
|
if (pathParts[0]) { |
|
|
|
// Then shorten the SHA of the commit
|
|
|
|
if (pathParts[0] === 'commit' || pathParts[0] === 'commits') { |
|
|
|
ref = ref.substring(0, 7) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// We're deploying master by default,
|
|
|
@ -108,7 +120,8 @@ export const isRepoPath = path => { |
|
|
|
|
|
|
|
const allowedHosts = [ |
|
|
|
'github.com', |
|
|
|
'gitlab.com' |
|
|
|
'gitlab.com', |
|
|
|
'bitbucket.org' |
|
|
|
] |
|
|
|
|
|
|
|
if (isURL(path)) { |
|
|
|