@@ -82,6 +82,25 @@ const hasRecentCommits = async (url) => {
8282 return elapsed <= inactivity_threshold
8383}
8484
85+
86+ const hasSufficientContributors = async ( url ) => {
87+ const [ owner , repo , ...unuseds ] = url . slice ( "https://github.com/" . length ) . split ( '/' ) ;
88+
89+ const contributors = await octokit . rest . repos . listContributors ( {
90+ owner,
91+ repo,
92+ } ) ;
93+
94+ let ncontributors = 0
95+ for ( const c of contributors . data ) {
96+ if ( c . contributions >= ncontributions_minimum ) {
97+ ncontributors ++ ;
98+ }
99+ }
100+
101+ return ncontributors >= ncontributors_minimum ;
102+ }
103+
85104const filterAsync = async ( arr , asyncCallback ) => {
86105 const promises = arr . map ( asyncCallback ) ;
87106 const results = await Promise . all ( promises ) ;
@@ -101,6 +120,8 @@ const urls_rsd = loadFromJsonfile('./urls.json');
101120const nworkflows_minimum = 1 ;
102121const npull_requests_minimum = 5 ;
103122const inactivity_threshold = 12 * 30 * 24 * 60 * 60 * 1000 // X months in milliseconds -> X months * 30 days/month * 24 hours/day * 60 min/hour * 60 sec/min * 1000
123+ const ncontributors_minimum = 3 ;
124+ const ncontributions_minimum = 5 ;
104125
105126const octokit = new Octokit ( { auth : process . env . GITHUB_TOKEN } ) ;
106127
@@ -110,6 +131,7 @@ urls = await filterAsync(urls, includeUsesPullRequests);
110131urls = await filterAsync ( urls , hasMultipleChangesToCitationcff ) ;
111132urls = await filterAsync ( urls , includeUsesWorkflows ) ;
112133urls = await filterAsync ( urls , hasRecentCommits ) ;
134+ urls = await filterAsync ( urls , hasSufficientContributors ) ;
113135urls . forEach ( url => console . log ( url ) )
114136
115137
0 commit comments