-
-
Save jacobheun/d2ff479ca991733c13cdcf688a1317e5 to your computer and use it in GitHub Desktop.
NYC to markdown list of names linked to github with counts for activities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"repos": [{ | |
"login": "libp2p", | |
"repo": "js-libp2p", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-bootstrap", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-crypto", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-kad-dht", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-keychain", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-mdns", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-delegated-content-routing", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-delegated-peer-routing", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-mplex", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-record", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-secio", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-tcp", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-webrtc-star", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-websocket-star", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-libp2p-websockets", | |
"after": "2020-08-27" | |
}, { | |
"login": "multiformats", | |
"repo": "js-mafmt", | |
"after": "2020-08-27" | |
}, { | |
"login": "multiformats", | |
"repo": "js-multiaddr", | |
"after": "2020-08-27" | |
}, { | |
"login": "multiformats", | |
"repo": "js-multibase", | |
"after": "2020-08-27" | |
}, { | |
"login": "multiformats", | |
"repo": "js-multihash", | |
"after": "2020-08-27" | |
}, { | |
"login": "multiformats", | |
"repo": "js-multihashing-async", | |
"after": "2020-08-27" | |
}, { | |
"login": "libp2p", | |
"repo": "js-peer-id", | |
"after": "2020-08-27" | |
}, { | |
"login": "ChainSafe", | |
"repo": "js-libp2p-gossipsub", | |
"after": "2020-08-27" | |
}, { | |
"login": "NodeFactoryIo", | |
"repo": "js-libp2p-noise", | |
"after": "2020-08-27" | |
}], | |
"orgs": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run like: | |
# GITHUB_TOKEN=<your_github_personal_access_token> ./exec.sh | |
echo "🏗 Installing name-your-contributors module..." | |
echo "> npm i -g name-your-contributors" | |
npm i -g name-your-contributors | |
echo "❤️ Naming contributors..." | |
echo "> name-your-contributors --config config.json > combined-out.json" | |
name-your-contributors --config config.json > combined-out.json | |
echo "📝 Generating list..." | |
echo "> node nyc-to-list.js combined-out.json" | |
node nyc-to-list.js combined-out.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* outputs something like this: | |
* [Aakil Fernandes](https://github.com/aakilfernandes) (1 comment) | |
* [Alan Shaw](https://github.com/alanshaw) (35 PRs, 8 issues, 99 reviews, 165 comments) | |
* [Aleksey Bykhun](https://github.com/caffeinum) (1 issue, 1 comment) | |
* [Alex Knol](https://github.com/Elexy) (1 issue) | |
* [Alex North](https://github.com/anorth) (1 comment) | |
* [Alex Potsides](https://github.com/achingbrain) (32 PRs, 6 issues, 38 reviews, 79 comments) | |
* [André Cruz](https://github.com/satazor) (1 issue, 2 comments) | |
* [ANUDAVIS](https://github.com/ANUDAVIS) (1 comment) | |
* [Arkadiy Kukarkin](https://github.com/parkan) (1 issue, 4 comments) | |
* [AT1452](https://github.com/AT1452) (1 issue) | |
*/ | |
const fs = require('fs') | |
const data = JSON.parse(fs.readFileSync(process.argv[2])) | |
const people = {} | |
data.repos.forEach(repo => { | |
Object.keys(repo.contributions).forEach(type => { | |
repo.contributions[type].forEach(person => { | |
if (people[person.login]) { | |
people[person.login].count += person.count | |
} else { | |
people[person.login] = person | |
} | |
people[person.login].counts = people[person.login].counts || {} | |
people[person.login].counts[type] = (people[person.login].counts[type] || 0) + person.count | |
}) | |
}) | |
}) | |
function plural (word, count) { | |
if (count === 1) return word | |
return `${word}s` | |
} | |
function getCounts (person) { | |
const counts = [] | |
if (person.counts.prCreators) counts.push(`${person.counts.prCreators} ${plural('PR', person.counts.prCreators)}`) | |
if (person.counts.issueCreators) counts.push(`${person.counts.issueCreators} ${plural('issue', person.counts.issueCreators)}`) | |
if (person.counts.reviewers) counts.push(`${person.counts.reviewers} ${plural('review', person.counts.reviewers)}`) | |
let totalComments = (person.counts.prCommentators || 0) + (person.counts.issueCommentators || 0) | |
if (totalComments) counts.push(`${totalComments} ${plural('comment', totalComments)}`) | |
if (counts.length) return ` (${counts.join(', ')})` | |
return '' | |
} | |
const sortedPeople = Object.values(people).sort((a, b) => (a.name || a.login).toLowerCase().localeCompare((b.name || b.login).toLowerCase())) | |
sortedPeople | |
.filter(p => p.name !== 'greenkeeper' && p.login !== 'greenkeeper') | |
.filter(p => p.name !== 'azure-pipelines' && p.login !== 'azure-pipelines') | |
.filter(p => p.name !== 'codecov' && p.login !== 'codecov') | |
.forEach(p => { | |
console.log(`* [${p.name || p.login}](${p.url})${getCounts(p)}`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment