Skip to content

Commit 5eef11b

Browse files
authored
fix(plugins/base): number of org packages is incorrect (lowlighter#1005) [skip ci]
1 parent 11a5c7c commit 5eef11b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

source/plugins/base/index.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ export default async function({login, graphql, rest, data, q, queries, imports},
173173
data.user[type].nodes.splice(repositories)
174174
console.debug(`metrics/compute/${login}/base > loaded ${data.user[type].nodes.length} ${type}`)
175175
}
176+
//Fetch missing packages count from ghcr.io using REST API (as GraphQL API does not support it yet)
177+
try {
178+
console.debug(`metrics/compute/${login}/base > patching packages count if possible`)
179+
const {data:packages} = await rest.packages[{user:"listPackagesForUser", organization:"listPackagesForOrganization"}[account]]({package_type:"container", org:login, username:login})
180+
data.user.packages.totalCount += packages.length
181+
console.debug(`metrics/compute/${login}/base > patched packages count (added ${packages.length} from ghcr.io)`)
182+
}
183+
catch {
184+
console.debug(`metrics/compute/${login}/base > failed to patch packages count, maybe read:packages scope was not provided`)
185+
}
176186
//Shared options
177187
let {"repositories.skipped":skipped, "users.ignored":ignored, "commits.authoring":authoring} = imports.metadata.plugins.base.inputs({data, q, account:"bypass"})
178188
data.shared = {"repositories.skipped":skipped, "users.ignored":ignored, "commits.authoring":authoring, "repositories.batch":_batch}

0 commit comments

Comments
 (0)