fix(plugins/followup): fallback to owner if collaborators are not accessible (relates #859)

This commit is contained in:
lowlighter
2022-02-08 19:24:32 -05:00
parent 2164e3c79e
commit 4983bad99d
2 changed files with 3 additions and 1 deletions

View File

@@ -67,7 +67,7 @@ export default async function({login, data, computed, imports, q, graphql, queri
console.debug(`metrics/compute/${login}/plugins > followup > processing ${owner}/${repo}`)
followup.indepth.repositories[`${owner}/${repo}`] = {stats:{}}
//Fetch users with push access
let {repository:{collaborators:{nodes:collaborators}}} = await graphql(queries.followup["repository.collaborators"]({repo, owner}))
let {repository:{collaborators:{nodes:collaborators}}} = await graphql(queries.followup["repository.collaborators"]({repo, owner})).catch(() => ({repository:{collaborators:{nodes:[{login:owner}]}}}))
console.debug(`metrics/compute/${login}/plugins > followup > found ${collaborators.length} collaborators`)
followup.indepth.repositories[`${owner}/${repo}`].collaborators = collaborators.map(({login}) => login)
//Fetch issues and pull requests created by collaborators