docs: add releases page (#1004)

This commit is contained in:
Benjamin Canac
2023-11-21 17:08:13 +01:00
committed by GitHub
parent f4be95dcf5
commit 762c5ebba1
12 changed files with 348 additions and 5 deletions

View File

@@ -0,0 +1,23 @@
import { Octokit } from '@octokit/rest'
function isUserABot (user) {
return user?.login?.endsWith('-bot') || user?.login?.endsWith('[bot]')
}
export default cachedEventHandler(async () => {
if (!process.env.NUXT_GITHUB_TOKEN) {
return []
}
const octokit = new Octokit({ auth: process.env.NUXT_GITHUB_TOKEN })
const pulls = await octokit.paginate(octokit.rest.pulls.list, {
owner: 'nuxt',
repo: 'ui',
state: 'closed'
})
return pulls.filter(pull => !!pull.merged_at).filter(pull => !isUserABot(pull.user))
}, {
maxAge: 60 * 60
})

View File

@@ -0,0 +1,18 @@
import { Octokit } from '@octokit/rest'
export default cachedEventHandler(async () => {
if (!process.env.NUXT_GITHUB_TOKEN) {
return []
}
const octokit = new Octokit({ auth: process.env.NUXT_GITHUB_TOKEN })
const { data: releases } = await octokit.rest.repos.listReleases({
owner: 'nuxt',
repo: 'ui'
})
return releases
}, {
maxAge: 60 * 60
})