Repository: add action users metrics (#472)

This commit is contained in:
Simon Lecoq
2021-08-12 16:19:40 +02:00
committed by GitHub
parent 2fbed5a9a0
commit c72543f67c
2 changed files with 18 additions and 0 deletions

View File

@@ -63,6 +63,18 @@ export default async function({login, q}, {data, rest, graphql, queries, account
//Override plugins parameters
q["projects.limit"] = 0
//Fetching users count if it's an action
try {
if (await rest.repos.getContent({owner:login, repo, path:"action.yml"})) {
console.debug(`metrics/compute/${login}/${repo} > this repository seems to be a GitHub action, fetching users using code search`)
const {data:{total_count}} = await rest.search.code({q:`uses ${login} ${repo} path:.github/workflows language:YAML`})
data.repo.actionUsersCount = total_count
}
}
catch {
//Ignore errors
}
//Core
await imports.plugins.core(...arguments)
await Promise.all(pending)