website icon indicating copy to clipboard operation
website copied to clipboard

Potentially use sourcecred for contribution leaderboard, including all GitHub interactions

Open olgabot opened this issue 5 years ago • 4 comments

SourceCred is a system that tracks contributions to an open-source project that is beyond code commits, e.g. issues, PRs, comments, references etc, in the form of "Cred" units. There is a GitHub Action in progress that could be used. Each organization can set weights for how much each interaction matters, as described in their Gentle Introduction to Cred. Here is an example in action on SourceCred itself: https://sourcecred.io/cred/timeline/@sourcecred/

(h/t to @luilzirber who used it here: https://github.com/dib-lab/sourmash/pull/837#issuecomment-585400941)

1. Set up SourceCred

Set up the SourceCred prototype

 Mon 17 Feb - 13:12  ~/code 
 @olgabot  git clone https://github.com/sourcecred/sourcecred.git
cd sourcecred
yarn install
yarn backend
zsh: correct 'yarn' to 'tar' [nyae]? n
Cloning into 'sourcecred'...
remote: Enumerating objects: 78, done.
remote: Counting objects: 100% (78/78), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 12815 (delta 47), reused 60 (delta 40), pack-reused 12737
Receiving objects: 100% (12815/12815), 6.44 MiB | 11.94 MiB/s, done.
Resolving deltas: 100% (9070/9070), done.
yarn install v1.22.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
✨  Done in 58.40s.
yarn run v1.22.0
$ NODE_ENV=development webpack --config config/webpack.config.backend.js
Removing contents of build directory: /Users/olgabot/code/sourcecred/bin
(node:25729) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
Hash: e5c10d955bf5293d64c1
Version: webpack 4.41.2
Time: 2326ms
Built at: 02/17/2020 1:13:26 PM
                            Asset      Size                          Chunks             Chunk Names
             createExampleRepo.js  21.8 KiB               createExampleRepo  [emitted]  createExampleRepo
        fetchAndPrintGithubOrg.js   150 KiB          fetchAndPrintGithubOrg  [emitted]  fetchAndPrintGithubOrg
       fetchAndPrintGithubRepo.js   149 KiB         fetchAndPrintGithubRepo  [emitted]  fetchAndPrintGithubRepo
generateGithubGraphqlFlowTypes.js    25 KiB  generateGithubGraphqlFlowTypes  [emitted]  generateGithubGraphqlFlowTypes
                    sourcecred.js   503 KiB                      sourcecred  [emitted]  sourcecred
Entrypoint sourcecred = sourcecred.js
Entrypoint generateGithubGraphqlFlowTypes = generateGithubGraphqlFlowTypes.js
Entrypoint fetchAndPrintGithubRepo = fetchAndPrintGithubRepo.js
Entrypoint fetchAndPrintGithubOrg = fetchAndPrintGithubOrg.js
Entrypoint createExampleRepo = createExampleRepo.js
[./src/backend/memoryCacheProvider.js] 924 bytes {fetchAndPrintGithubRepo} [built]
[./src/cli/command.js] 242 bytes {sourcecred} [built]
[./src/cli/main.js] 521 bytes {sourcecred} [built]
[./src/cli/sourcecred.js] 914 bytes {sourcecred} [built]
[./src/plugins/git/bin/createExampleRepo.js] 1.13 KiB {createExampleRepo} [built]
[./src/plugins/git/example/exampleRepo.js] 3.66 KiB {createExampleRepo} [built]
[./src/plugins/github/bin/fetchAndPrintGithubOrg.js] 1.27 KiB {fetchAndPrintGithubOrg} [built]
[./src/plugins/github/bin/fetchAndPrintGithubRepo.js] 1.36 KiB {fetchAndPrintGithubRepo} [built]
[./src/plugins/github/bin/generateGraphqlFlowTypes.js] 115 bytes {generateGithubGraphqlFlowTypes} [built]
[./src/plugins/github/fetchGithubOrg.js] 2.37 KiB {sourcecred} {fetchAndPrintGithubOrg} [built]
[./src/plugins/github/fetchGithubRepo.js] 7.18 KiB {sourcecred} {fetchAndPrintGithubRepo} {fetchAndPrintGithubOrg} [built]
[./src/plugins/github/generateGraphqlFlowTypes.js] 1.27 KiB {generateGithubGraphqlFlowTypes} [built]
[./src/plugins/github/repoId.js] 858 bytes {sourcecred} {fetchAndPrintGithubRepo} {fetchAndPrintGithubOrg} [built]
[./src/plugins/github/token.js] 1.37 KiB {sourcecred} {fetchAndPrintGithubRepo} {fetchAndPrintGithubOrg} [built]
[./src/tools/entry.js] 509 bytes {sourcecred} [built]
    + 96 hidden modules
✨  Done in 3.54s.

2. Run SourceCred on all nf-core repos

Ran sourcedcred on all repos using a modified one-liner from a comment on how to clone all repos of an organization

curl -s https://api.github.com/orgs/nf-core/repos | grep full_name | cut -d \" -f 4 | grep -vE 'configs|tools' | xargs node bin/sourcecred.js load

Ran into some issues with the tools and configs repos that was supposedly fixed (https://github.com/sourcecred/sourcecred/pull/1337) so I didn't debug:

 ✘  Mon 17 Feb - 13:25  ~/code/sourcecred   origin ☊ master ✔ 
 @olgabot  curl -s https://api.github.com/orgs/nf-core/repos | grep full_name | cut -d \" -f 4 | xargs node bin/sourcecred.js load

  GO   github/nf-core/cookiecutter
 DONE  github/nf-core/cookiecutter: 14s
  GO   compute-cred
 DONE  compute-cred: 128ms
  GO   github/nf-core/nf-core.github.io
 DONE  github/nf-core/nf-core.github.io: 14s
  GO   compute-cred
 DONE  compute-cred: 66ms
  GO   github/nf-core/tools
Warning: when setting Reaction["MDg6UmVhY3Rpb24zMDY0NTMwMw=="].user: object "MDEyOk9yZ2FuaXphdGlvbjIyOTA4NDM4" looks like it should have type "Organization", but the server claims that it has type "User"
Error: Unknown type: undefined
    at Mirror._nontransactionallyUpdateOwnData (webpack:///./src/graphql/mirror.js?:428:176)
    at Mirror._nontransactionallyUpdateData (webpack:///./src/graphql/mirror.js?:249:235)
    at eval (webpack:///./src/graphql/mirror.js?:262:821)
    at _inTransaction (webpack:///./src/graphql/mirror.js?:577:142)
    at Mirror._updateStep (webpack:///./src/graphql/mirror.js?:262:690)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Mirror.update (webpack:///./src/graphql/mirror.js?:292:44)
    at async fetchGithubRepo (webpack:///./src/plugins/github/fetchGithubRepo.js?:57:74)
    at async Object.updateMirror (webpack:///./src/plugins/github/loader.js?:12:377)

Similar issue with configs:

 ✘  Mon 17 Feb - 13:28  ~/code/sourcecred   origin ☊ master ✔ 
 @olgabot  curl -s https://api.github.com/orgs/nf-core/repos | grep full_name | cut -d \" -f 4 | sort | xargs node bin/sourcecred.js load

  GO   github/nf-core/ampliseq
 DONE  github/nf-core/ampliseq: 32s
  GO   compute-cred
 DONE  compute-cred: 521ms
  GO   github/nf-core/atacseq
 DONE  github/nf-core/atacseq: 1m 59s
  GO   compute-cred
 DONE  compute-cred: 563ms
  GO   github/nf-core/bacass
 DONE  github/nf-core/bacass: 46s
  GO   compute-cred
 DONE  compute-cred: 153ms
  GO   github/nf-core/bcellmagic
 DONE  github/nf-core/bcellmagic: 1m 6s
  GO   compute-cred
 DONE  compute-cred: 285ms
  GO   github/nf-core/chipseq
 DONE  github/nf-core/chipseq: 53s
  GO   compute-cred
 DONE  compute-cred: 2s
  GO   github/nf-core/clinvap
 DONE  github/nf-core/clinvap: 7s
  GO   compute-cred
 DONE  compute-cred: 6ms
  GO   github/nf-core/configs
Warning: when setting Reaction["MDg6UmVhY3Rpb24zODM2NzQxNg=="].user: object "MDEyOk9yZ2FuaXphdGlvbjM3MTQ3NjU0" looks like it should have type "Organization", but the server claims that it has type "User"
Error: Unknown type: undefined
    at Mirror._nontransactionallyUpdateOwnData (webpack:///./src/graphql/mirror.js?:428:176)
    at Mirror._nontransactionallyUpdateData (webpack:///./src/graphql/mirror.js?:249:235)
    at eval (webpack:///./src/graphql/mirror.js?:262:821)
    at _inTransaction (webpack:///./src/graphql/mirror.js?:577:142)
    at Mirror._updateStep (webpack:///./src/graphql/mirror.js?:262:690)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Mirror.update (webpack:///./src/graphql/mirror.js?:292:44)
    at async fetchGithubRepo (webpack:///./src/plugins/github/fetchGithubRepo.js?:57:74)
    at async Object.updateMirror (webpack:///./src/plugins/github/loader.js?:12:377)
    at async Promise.all (index 0)

So instead of fixing it, I ignored the tools and config repos 🙃

Example output

Timeline

Screen Shot 2020-02-17 at 1 57 58 PM

Example weights

Screen Shot 2020-02-17 at 1 57 44 PM

(I tried building an interactive version on Netlify but building the site took over 20min which exceeds Netlify's limit)

Could be an interesting way to recognize the contributions of the community at large!

olgabot avatar Feb 18 '20 05:02 olgabot

It looks quite impressive

maxulysse avatar Feb 18 '20 12:02 maxulysse

Awesome! What's the final output? A static HTML file? Can you zip it and attach it to this issue?

ewels avatar Feb 18 '20 14:02 ewels

Good find @olgabot! This does look really cool :sunglasses:

drpatelh avatar Feb 18 '20 14:02 drpatelh

❤️ it too! Seems like this is a bit more detailed than just counting commits ...?

apeltzer avatar Feb 28 '20 21:02 apeltzer