mirror of
https://github.com/oceanprotocol/community-numbers.git
synced 2024-12-23 01:29:49 +01:00
tinkering
This commit is contained in:
parent
e4b5f3b552
commit
477912857d
@ -23,7 +23,8 @@ Endpoint: [`https://oceanprotocol-community.now.sh`](https://oceanprotocol-commu
|
||||
{
|
||||
"github": {
|
||||
"stars": 1000,
|
||||
"repos": 1000
|
||||
"repos": 1000,
|
||||
"contributors": 1000
|
||||
},
|
||||
"medium": {
|
||||
"followers": 1000
|
||||
|
@ -24,16 +24,31 @@ export default async function fetchGitHubRepos() {
|
||||
return null
|
||||
}
|
||||
|
||||
const json = await response.json()
|
||||
const numbers = json.map((item) => item.stargazers_count)
|
||||
const stars = arrSum(numbers)
|
||||
const repositories = json.length
|
||||
const jsonRepos = await response.json()
|
||||
|
||||
const starsArray = []
|
||||
const contribArray = []
|
||||
|
||||
jsonRepos.forEach(async (item) => {
|
||||
starsArray.push(item.stargazers_count)
|
||||
|
||||
const responseContrib = await fetch(
|
||||
`https://api.github.com/orgs/oceanprotocol/${item.name}/stats/contributors`,
|
||||
options
|
||||
)
|
||||
const jsonContrib = await responseContrib.json()
|
||||
contribArray.push(jsonContrib.total)
|
||||
})
|
||||
|
||||
const stars = arrSum(starsArray)
|
||||
const repositories = jsonRepos.length
|
||||
const contributors = arrSum(contribArray)
|
||||
|
||||
log(
|
||||
'✓ GitHub. ' +
|
||||
`Total: ${repositories} public projects with a total of ${stars} stargazers. ` +
|
||||
`Total: ${repositories} public projects with a total of ${stars} stargazers & ${contributors} contributors. ` +
|
||||
`Elapsed: ${new Date() - start}ms`
|
||||
)
|
||||
|
||||
return { stars, repositories }
|
||||
return { stars, repositories, contributors }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user