@@ -5,7 +5,9 @@ import type {
55 ModuleOptions
66} from '../../../module'
77import { GithubRawRelease , GithubRepositoryOptions , GithubRawContributors , GithubContributorsQuery , GithubReleasesQuery , GithubRepositoryReadme , GithubRepository } from '../../types'
8+ // @ts -ignore
89import { parseContent } from '#content/server'
10+
911function isBot ( user ) {
1012 return user . login . includes ( '[bot]' ) || user . login . includes ( '-bot' ) || user . login . includes ( '.bot' )
1113}
@@ -54,11 +56,19 @@ export function githubGraphqlQuery<T = any> (query: string, options: Partial<Mod
5456 return gq < T > ( query )
5557}
5658
57- export const parseRelease = async ( release : GithubRawRelease ) => {
59+ export const parseRelease = async ( release : GithubRawRelease , githubConfig : GithubRepositoryOptions ) => {
5860 return {
5961 ...release ,
6062 // Parse release notes when `@nuxt/content` is installed.
61- ...( typeof parseContent === 'function' && release ?. body && release ?. name ? await parseContent ( `github:${ release . name } .md` , release . body ) : { } )
63+ ...( typeof parseContent === 'function' && release ?. body && release ?. name ? await parseContent ( `github:${ release . name } .md` , release . body ) : { } , {
64+ markdown : {
65+ remarkPlugins : {
66+ 'remark-github' : {
67+ repository : `${ githubConfig . owner } /${ githubConfig . repo } `
68+ }
69+ }
70+ }
71+ } )
6272 }
6373}
6474
@@ -77,15 +87,12 @@ export async function fetchRepository ({ api, owner, repo, token }: GithubReposi
7787 }
7888 } ) . catch ( ( _ ) => {
7989 /*
80-
8190 // eslint-disable-next-line no-console
8291 console.warn(`Cannot fetch GitHub Repository on ${url} [${err.response?.status || 500}]`)
8392
8493 // eslint-disable-next-line no-console
8594 console.info('If your repository is private, make sure to provide GITHUB_TOKEN environment in `.env`')
86-
8795 */
88-
8996 return { }
9097 } )
9198
@@ -103,7 +110,6 @@ export async function fetchRepositoryContributors ({ max }: Partial<GithubContri
103110 }
104111 } ) . catch ( ( _ ) => {
105112 /*
106-
107113 // eslint-disable-next-line no-console
108114 console.warn(`Cannot fetch GitHub contributors on ${url} [${err.response?.status || 500}]`)
109115
@@ -114,9 +120,7 @@ export async function fetchRepositoryContributors ({ max }: Partial<GithubContri
114120 // eslint-disable-next-line no-console
115121 console.info('To disable fetching contributors, set `github.contributors` to `false` in `nuxt.config.ts`')
116122 }
117-
118123 */
119-
120124 return [ ]
121125 } )
122126
@@ -151,7 +155,6 @@ export async function fetchFileContributors ({ source, max }: Partial<GithubCont
151155 { token }
152156 ) . catch ( ( _ ) => {
153157 /*
154-
155158 // eslint-disable-next-line no-console
156159 console.warn(`Cannot fetch GitHub file contributors on ${source} [${err.response?.status || 500}]`)
157160
@@ -162,7 +165,6 @@ export async function fetchFileContributors ({ source, max }: Partial<GithubCont
162165 // eslint-disable-next-line no-console
163166 console.info('To disable fetching contributors, set `github.contributors` to `false` in `nuxt.config.ts`')
164167 }
165-
166168 */
167169 } )
168170
@@ -202,7 +204,6 @@ export async function fetchReleases (query: Partial<GithubReleasesQuery>, { api,
202204 }
203205 } ) . catch ( ( _ ) => {
204206 /*
205-
206207 // eslint-disable-next-line no-console
207208 console.warn(`Cannot fetch GitHub releases on ${url} [${err.response?.status || 500}]`)
208209
@@ -213,7 +214,6 @@ export async function fetchReleases (query: Partial<GithubReleasesQuery>, { api,
213214 // eslint-disable-next-line no-console
214215 console.info('To disable fetching releases, set `github.releases` to `false` in `nuxt.config.ts`')
215216 }
216-
217217 */
218218 } )
219219
@@ -233,13 +233,11 @@ export async function fetchReadme ({ api, owner, repo, token }: GithubRepository
233233 }
234234 } ) . catch ( ( _ ) => {
235235 /*
236-
237236 // eslint-disable-next-line no-console
238237 console.warn(`Cannot fetch GitHub readme on ${url} [${err.response?.status || 500}]`)
239238
240239 // eslint-disable-next-line no-console
241240 console.info('If your repository is private, make sure to provide GITHUB_TOKEN environment in `.env`')
242-
243241 */
244242
245243 return { }
0 commit comments