mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-02 18:18:06 +08:00
fix(route): github pull requests (#9341)
* fix(route): github pull * fix: typo
This commit is contained in:
@@ -5,13 +5,14 @@ const md = require('markdown-it')({
|
||||
linkify: true,
|
||||
});
|
||||
const queryString = require('query-string');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const user = ctx.params.user;
|
||||
const repo = ctx.params.repo;
|
||||
const state = ctx.params.state ?? 'open';
|
||||
|
||||
const host = `https://github.com/${user}/${repo}/pulls`;
|
||||
const link = `https://github.com/${user}/${repo}/pull`;
|
||||
const url = `https://api.github.com/repos/${user}/${repo}/pulls`;
|
||||
|
||||
const headers = {};
|
||||
@@ -22,7 +23,10 @@ module.exports = async (ctx) => {
|
||||
method: 'get',
|
||||
url,
|
||||
searchParams: queryString.stringify({
|
||||
state,
|
||||
sort: 'created',
|
||||
direction: 'desc',
|
||||
per_page: ctx.query.limit ? (parseInt(ctx.query.limit) <= 100 ? parseInt(ctx.query.limit) : 100) : 100,
|
||||
}),
|
||||
headers,
|
||||
});
|
||||
@@ -36,8 +40,8 @@ module.exports = async (ctx) => {
|
||||
title: item.title,
|
||||
author: item.user.login,
|
||||
description: item.body ? md.render(item.body) : 'No description',
|
||||
pubDate: new Date(item.created_at).toUTCString(),
|
||||
link: `${link}/${item.number}`,
|
||||
pubDate: parseDate(item.created_at),
|
||||
link: item.html_url,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user