-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
75 lines (54 loc) · 5.35 KB
/
index.js
File metadata and controls
75 lines (54 loc) · 5.35 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const getHeadlines = require('./utils/getHeadlines');
const issue = require('./utils/issue');
const fs = require('fs');
// 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-monthly',
title: `GitHub Monthly Top 10 @${new Date(date).toISOString().slice(0, 10)}`,
body: contents,
});
const issueNumber = res.data.number;
await issue.lock({
owner: 'headllines',
repo: 'github-monthly',
issueNumber,
});
const readmeContent = `
# GitHub Monthly Top 10 repositories
[](http://rsshub.app/github/issue/headllines/github-monthly)
[](https://t.me/headllines)
[](https://github.com/headllines/github-monthly/issues)
[](https://github.com/headllines/github-monthly/watchers)
[](https://feeds.pub/feed/https%3A%2F%2Frsshub.app%2Fgithub%2Fissue%2Fheadllines%2Fgithub-monthly)
## How to subscribe
Top repos are stored in [issues](https://github.com/headllines/github-monthly/issues). You can subscribe by [watching this repo](#how-does-it-work) or via [RSS](https://feeds.pub/feed/http%3A%2F%2Frsshub.app%2Fgithub%2Fissue%2Fheadllines%2Fgithub-monthly)
Email and other ways to subscribe updates are still under development, you can join [the mailing list](https://headllines.com) to get notified.
## How does it work
1. A script fetches top repos on github every day
2. It opens an issue on this repo and store the headlines
3. People can subscribe to new issue by watching this repo or via [RSS](https://feeds.pub/feed/http%3A%2F%2Frsshub.app%2Fgithub%2Fissue%2Fheadllines%2Fgithub-monthly)
<img src="https://timqian-imgs.s3.ap-southeast-1.amazonaws.com/2020-09-Screen%20Shot%202020-09-01%20at%205.15.54%20PM.png" alt="github monthly" width="400"/>
## Related headline collectors
- [GitHub Daily](https://github.com/headllines/github-daily)
- [GitHub Weekly](https://github.com/headllines/github-weekly)
## Thanks
- [doforce/github-trending](https://github.com/doforce/github-trending) to get trending repos daily/weekly/monthly
- [github-trending-api](https://github.com/huchenme/github-trending-api) to get trending repos daily/weekly/monthly
- [Feeds.Pub](https://feeds.pub) for hosting the RSS feed
- [RSSHub](https://github.com/diygod/rsshub) for generating RSS file from issues
- [github-trending-repos](https://github.com/vitalets/github-trending-repos) for inspiration
## Contribute
We at [headllines.com](https://headllines.com) build open source headline collectors, if you are interested in writing an headline collector and join this organization, feel free to join our [telegram group](https://t.me/headllines)
## Authors
- [timqian](https://github.com/timqian)
- [leadream](https://github.com/leadream)
> Updated at ${new Date()}
`;
fs.writeFileSync('./README.md', readmeContent, 'utf8');
}
run(new Date())
.catch(err => {throw err});