-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (21 loc) · 603 Bytes
/
index.js
File metadata and controls
25 lines (21 loc) · 603 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
25
const getHeadlines = require('./utils/getHeadlines');
const issue = require('./utils/issue');
// run every day at 00:01 UTC
const run = async (date) => {
const contents = await getHeadlines(date);
// console.log(contents)
const res = await issue.open({
owner: 'headllines',
repo: 'github-daily',
title: `GitHub Daily Top 10 @${new Date(date).toISOString().slice(0, 10)}`,
body: contents,
});
const issueNumber = res.data.number;
await issue.lock({
owner: 'headllines',
repo: 'github-daily',
issueNumber,
});
}
run(new Date())
.catch(err => {throw err});