mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 13:39:35 +08:00
add Github Pull requests rss feed (#1549)
add Github pull requests rss feed with `github/pull/{user}/{repo}` this pattern
This commit is contained in:
@@ -682,6 +682,8 @@ GitHub 官方也提供了一些 RSS:
|
|||||||
|
|
||||||
<route name="仓库 Issue" author="HenryQW" example="/github/issue/DIYgod/RSSHub" path="/github/issue/:user/:repo" :paramsDesc="['用户名', '仓库名']"/>
|
<route name="仓库 Issue" author="HenryQW" example="/github/issue/DIYgod/RSSHub" path="/github/issue/:user/:repo" :paramsDesc="['用户名', '仓库名']"/>
|
||||||
|
|
||||||
|
<route name="仓库 Pull Requests" author="hashman" example="/github/pull/DIYgod/RSSHub" path="/github/pull/:user/:repo" :paramsDesc="['用户名', '仓库名']"/>
|
||||||
|
|
||||||
<route name="用户" author="HenryQW" example="/github/user/followers/HenryQW" path="/github/user/followers/:user" :paramsDesc="['用户名']"/>
|
<route name="用户" author="HenryQW" example="/github/user/followers/HenryQW" path="/github/user/followers/:user" :paramsDesc="['用户名']"/>
|
||||||
|
|
||||||
<route name="仓库 Stars" author="HenryQW" example="/github/stars/DIYgod/RSSHub" path="/github/stars/:user/:repo" :paramsDesc="['用户名', '仓库名']"/>
|
<route name="仓库 Stars" author="HenryQW" example="/github/stars/DIYgod/RSSHub" path="/github/stars/:user/:repo" :paramsDesc="['用户名', '仓库名']"/>
|
||||||
|
|||||||
@@ -321,6 +321,7 @@ if (config.github && config.github.access_token) {
|
|||||||
}
|
}
|
||||||
router.get('/github/trending/:since/:language?', require('./routes/github/trending'));
|
router.get('/github/trending/:since/:language?', require('./routes/github/trending'));
|
||||||
router.get('/github/issue/:user/:repo', require('./routes/github/issue'));
|
router.get('/github/issue/:user/:repo', require('./routes/github/issue'));
|
||||||
|
router.get('/github/pull/:user/:repo', require('./routes/github/pulls'));
|
||||||
router.get('/github/user/followers/:user', require('./routes/github/follower'));
|
router.get('/github/user/followers/:user', require('./routes/github/follower'));
|
||||||
router.get('/github/stars/:user/:repo', require('./routes/github/star'));
|
router.get('/github/stars/:user/:repo', require('./routes/github/star'));
|
||||||
router.get('/github/search/:query/:sort?/:order?', require('./routes/github/search'));
|
router.get('/github/search/:query/:sort?/:order?', require('./routes/github/search'));
|
||||||
|
|||||||
34
lib/routes/github/pulls.js
Normal file
34
lib/routes/github/pulls.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const config = require('../../config');
|
||||||
|
const md = require('markdown-it')({
|
||||||
|
html: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const user = ctx.params.user;
|
||||||
|
const repo = ctx.params.repo;
|
||||||
|
|
||||||
|
const host = `https://github.com/${user}/${repo}/pull`;
|
||||||
|
const url = `https://api.github.com/repos/${user}/${repo}/pulls`;
|
||||||
|
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url,
|
||||||
|
params: {
|
||||||
|
sort: 'created',
|
||||||
|
access_token: config.github.access_token,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const data = response.data;
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${user}/${repo} Pull requests`,
|
||||||
|
link: host,
|
||||||
|
item: data.map((item) => ({
|
||||||
|
title: item.title,
|
||||||
|
description: md.render(item.body) || 'No description',
|
||||||
|
pubDate: new Date(item.created_at).toUTCString(),
|
||||||
|
link: `${host}/${item.number}`,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user