forked from bengHak/github-commit-crawler
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtask.js
More file actions
24 lines (23 loc) · 796 Bytes
/
task.js
File metadata and controls
24 lines (23 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { getLastSavedCommitTime, saveCommit } = require('./api/db');
const { getUnsavedCommit } = require('./api/slack');
const { member_list_github } = require('./config/config');
switch (process.argv[2]) {
case 'save':
(async () => {
const lastTime = await getLastSavedCommitTime().then((res) => res);
let unSavedCommit = await getUnsavedCommit(lastTime);
// console.log(unSavedCommit);
unSavedCommit = unSavedCommit.reverse();
unSavedCommit.map(async (e) => {
if (!member_list_github.includes(e['author_name'])) {
return;
}
await saveCommit({
username: e['author_name'],
commitLink: e['commit_link'],
timestamp: e['timestamp'],
});
});
// console.log(new Date());
})();
}