MCPcopy Index your code
hub / github.com/FirefoxCSS-Store/FirefoxCSS-Store.github.io / readGitlab

Function readGitlab

scripts/repository-stats.mjs:65–77  ·  view source on GitHub ↗
({ owner, name })

Source from the content-addressed store, hash-verified

63}
64
65async function readGitlab({ owner, name }) {
66 const headers = gitlabToken ? { Authorization: `Bearer ${gitlabToken}` } : {}
67 const encoded = encodeURIComponent(`${owner}/${name}`)
68 const data = await requestJson(`https://gitlab.com/api/v4/projects/${encoded}`, headers)
69 const avatar = data.namespace?.avatar_url ?? null
70
71 return {
72 stars: data.star_count ?? 0,
73 updatedAt: data.last_activity_at ?? null,
74 ownerAvatar: avatar?.startsWith('/') ? `https://gitlab.com${avatar}` : avatar,
75 accessible: true
76 }
77}
78
79async function readCodeberg({ owner, name }) {
80 const headers = codebergToken ? { Authorization: `token ${codebergToken}` } : {}

Callers 1

fetchRepositoryStatsFunction · 0.70

Calls 1

requestJsonFunction · 0.85

Tested by

no test coverage detected