mirror of
https://gitee.com/antv/g6.git
synced 2024-11-29 18:28:19 +08:00
chore: refactor contribute script (#5985)
This commit is contained in:
parent
8160df7201
commit
aa51954a7b
@ -30,12 +30,13 @@ function checkStagingArea() {
|
||||
}
|
||||
|
||||
function parseGithubUrl(url) {
|
||||
const regex = /https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/;
|
||||
const regex = /https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(\/(.+))*/;
|
||||
const match = url.match(regex);
|
||||
if (!match) {
|
||||
throw new Error('无法解析 GitHub URL');
|
||||
}
|
||||
return { username: match[1], repository: match[2], branch: match[3] + '/' + match[4] };
|
||||
const [, username, repository, ...branch] = match;
|
||||
return { username, repository, branch: branch.filter(Boolean).join('/') };
|
||||
}
|
||||
|
||||
function addRemoteAndCheckoutBranch(username, branch) {
|
||||
|
Loading…
Reference in New Issue
Block a user