feat(route): make GitHub pulls title and docs consistent with issues (#21903)
* feat(route): make GitHub pulls title and docs consistent with issues I'm not really a coder, but I use RSSHub to bridge GitHub updates into IRC for my community. I noticed that the `pulls.ts` route didn't show the "Open/Closed" state in the feed title like the `issues.ts` route does, which was making my users a bit confused! I tried my best to replicate the logic and metadata structure from `issues.ts` over to `pulls.ts`. Changes: - Updated the feed title to dynamically show the state (Open/Closed/All) and any labels. - Updated the parameter metadata so the documentation looks as clean and organized as the Issues page. I've tested this locally and it’s working perfectly for my IRC tracker. Hopefully, this helps keep things consistent across the GitHub routes! Closes #21902 * Fix title formatting in pull request response
This commit is contained in:
parent
8b302d70b6
commit
78068da475
|
|
@ -14,7 +14,29 @@ export const route: Route = {
|
|||
path: '/pull/:user/:repo/:state?/:labels?',
|
||||
categories: ['programming'],
|
||||
example: '/github/pull/DIYgod/RSSHub',
|
||||
parameters: { user: 'User name', repo: 'Repo name', state: 'the state of pull requests. Can be either `open`, `closed`, or `all`. Default: `open`.', labels: 'a list of comma separated label names' },
|
||||
parameters: {
|
||||
user: 'GitHub username',
|
||||
repo: 'GitHub repo name',
|
||||
state: {
|
||||
description: 'the state of pull requests.',
|
||||
default: 'open',
|
||||
options: [
|
||||
{
|
||||
label: 'Open',
|
||||
value: 'open',
|
||||
},
|
||||
{
|
||||
label: 'Closed',
|
||||
value: 'closed',
|
||||
},
|
||||
{
|
||||
label: 'All',
|
||||
value: 'all',
|
||||
},
|
||||
],
|
||||
},
|
||||
labels: 'a list of comma separated label names',
|
||||
},
|
||||
features: {
|
||||
requireConfig: false,
|
||||
requirePuppeteer: false,
|
||||
|
|
@ -61,7 +83,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
allowEmpty: true,
|
||||
title: `${user}/${repo} Pull requests`,
|
||||
title: `${user}/${repo} ${state.replace(/^\S/, (s) => s.toUpperCase())} Pull Requests${labels ? ' - ' + labels : ''}`,
|
||||
link: host,
|
||||
item: data.map((item) => ({
|
||||
title: item.title,
|
||||
|
|
|
|||
Loading…
Reference in New Issue