-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-test.js
40 lines (31 loc) · 1.17 KB
/
git-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const mv = require('mv');
let scrape = async () => {
const USER = process.env.GIT_USER;
const PASS = process.env.GIT_PASS;
const REPO = 'github.com/felipequintella/covid19-brazil-scraper';
const remote = `https://${USER}:${PASS}@${REPO}`;
const simpleGit = require('simple-git/promise');
const git = simpleGit();
const result = await git.checkIsRepo();
console.log(result);
console.log("getting in")
if (result === false) {
console.log("inside false");
await git.clone(remote, "./tmp-repo/", ["--no-checkout"]);
console.log("cloned");
// await git.mv("tmp-repo/.git", '.git');
await mv('./tmp-repo/.git', '.git', {mkdirp: true}, function(err) {});
console.log("moved");
await git.reset("--hard", "HEAD")
console.log("reset");
} else if (result === true) {
console.log("inside true")
}
console.log("out")
// git.add('./brazil.csv')
// git.commit('updating data')
// git.removeRemote('origin')
// git.addRemote('origin', remote)
// await git.push('origin', 'master');
}
scrape();