@@ -116,6 +116,25 @@ const hasRecentCommits = async (url) => {
116116 return elapsed <= inactivity_threshold
117117}
118118
119+
120+ const hasSufficientContributors = async ( url ) => {
121+ const [ owner , repo , ...unuseds ] = url . slice ( "https://github.com/" . length ) . split ( '/' ) ;
122+
123+ const contributors = await octokit . rest . repos . listContributors ( {
124+ owner,
125+ repo,
126+ } ) ;
127+
128+ let ncontributors = 0
129+ for ( const c of contributors . data ) {
130+ if ( c . contributions >= ncontributions_minimum ) {
131+ ncontributors ++ ;
132+ }
133+ }
134+
135+ return ncontributors >= ncontributors_minimum ;
136+ }
137+
119138const filterAsync = async ( arr , asyncCallback ) => {
120139 const promises = arr . map ( asyncCallback ) ;
121140 const results = await Promise . all ( promises ) ;
@@ -135,6 +154,8 @@ const urls_rsd = loadFromJsonfile('./urls.json');
135154const nworkflows_minimum = 1 ;
136155const npull_requests_minimum = 5 ;
137156const 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
157+ const ncontributors_minimum = 3 ;
158+ const ncontributions_minimum = 5 ;
138159
139160const octokit = new Octokit ( { auth : process . env . GITHUB_TOKEN } ) ;
140161
@@ -145,6 +166,7 @@ urls = await filterAsync(urls, hasMultipleChangesToCitationcff);
145166urls = await filterAsync ( urls , includeUsesWorkflows ) ;
146167urls = await filterAsync ( urls , hasRecentCommits ) ;
147168urls = await filterAsync ( urls , includeHasValidcff ) ;
169+ urls = await filterAsync ( urls , hasSufficientContributors ) ;
148170urls . forEach ( url => console . log ( url ) )
149171
150172
0 commit comments