Skip to content

Commit

Permalink
🐛 Fix init new repo error
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-Xu-0100 committed Oct 25, 2020
1 parent 8e9c661 commit 5adbaf9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
9 changes: 2 additions & 7 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ async function run() {
setOutput('traffic_path', traffic_branch_path);
endGroup();
await group('Init traffic data', async () => {
if (!(await initData(traffic_branch, traffic_branch_path))) {
throw Error(`Init traffic data into ${traffic_branch_path} fail!`);
}
await initData(traffic_branch, traffic_branch_path);
});
for (let i = 0; i < static_list.length; i++) {
startGroup(`Set traffic data of ${static_list[i]}`);
Expand Down
5 changes: 1 addition & 4 deletions src/traffic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ let initData = async function (branch, path) {
});
execSync(`git clone ${clone_url} ${path} -b ${branch} --depth=1`);
rmRF(join(path, '.git'));
return true;
} catch (error) {
if (error.message != 'Branch not found') {
rmRF(path);
debug('[initData]: ' + error);
throw Error(error.message);
} else {
Expand All @@ -34,9 +34,6 @@ let initData = async function (branch, path) {
debug('clone_url:' + clone_url);
debug('traffic_branch_path:' + path);
info(`[INFO]: The branch ${branch} not found`);
rmRF(path);
info(`[INFO]: Successfully clean ${path}`);
return false;
}
}
};
Expand Down

0 comments on commit 5adbaf9

Please sign in to comment.