From 4983bad99d5c017faacac19491ec39f2f7705f38 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Tue, 8 Feb 2022 19:24:32 -0500 Subject: [PATCH] fix(plugins/followup): fallback to owner if collaborators are not accessible (relates #859) --- source/plugins/followup/README.md | 2 ++ source/plugins/followup/index.mjs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/plugins/followup/README.md b/source/plugins/followup/README.md index 6b2cd93c673..23537776107 100644 --- a/source/plugins/followup/README.md +++ b/source/plugins/followup/README.md @@ -77,6 +77,8 @@ The `plugin_followup_indepth` option collects additional stats to differentiate It helps knowing whether repositories are also maintained by other users and give an overall health status of repositories. +> ⚠️ This mode will try to list users with push access to know who are the maintainers in order to place issues in the correct category, which requires a `repo` scope. If not available, it will consider that only the owner is a maintainer. + ## ℹ️ Examples workflows diff --git a/source/plugins/followup/index.mjs b/source/plugins/followup/index.mjs index 27a7393cfda..52363793eeb 100644 --- a/source/plugins/followup/index.mjs +++ b/source/plugins/followup/index.mjs @@ -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