Home

Awesome

Contributors list

Build awesome list of the contributors of your project! You can even filter your contributors to list only those individuals who committed after a specific date or who committed to a specific branch or SHA.

Demo

Usage

In order to get the contributors list for your open-source project use:

githubcontrib --owner USERNAME --repo REPO_NAME --cols 6 --filter user1,user2,user3 | pbcopy

Advanced API

Parameter nameDescriptionDefault valueSample value
repoRepository name. ](required)--repo angular-material
ownerRepository owner that the repo belongs to.(required)--owner angular
fromDateYYYY-MM-DD used to determine only the contributors after the specified commit fromDate.''--fromDate 2016-04-01
shaSHA or branch name to start listing commits from. Default == the repository’s default branch (usually master).''--sha e58f3629e
sortOrderSpecifies the sort order.'asc'--sortOrder desc
sortBySpecifies the sort property. It will be passed as third argument to the sortStrategy.'contributions'--sortBy login
sortStrategyCustom sort strategy. Built-in strategies support string and number comparison.'../lib/sort_strategies/sort_asc.js'--sortStrategy custom_sort.js
layoutStrategySpecifies how the output will be formatted.'../lib/layout_strategies/table.js'--layoutStrategy custom_layout.js
filterSpecifies users to be filtered.[]--filter userlogin1,userlogin2
filterStrategySpecifies the filter strategy.'../lib/filter_strategies/login.js'--filterStrategy custom_filter.js
authTokenSpecifies the scope-limited Github oAuth application token: required increase your request rate limit to 5000 / hour.''--authToken 0da9a3f98dff9a61a0222fd5db201221c5b129f8

This way your contributors will be formatted in a table with their photos.

The table strategy accepts the following parameters:

Different ways of formatting

You can easily add more formatting strategies by exporting the formatting logic.

Here's a sample implementation of a list layout strategy:

var formatter = function (options) {
  options = options || {};
  var field = options.field || 'login',
      numbered = options.style === 'numbers';

  return function (data) {
    var result = '\n';
    data.forEach(function (user, idx) {
      if (numbered) {
        result += idx + 1;
      } else {
        result += '-';
      }
      result += ' ' + user[field] + '\n';
    });
    return result;
  };
};

module.exports = formatter;

Testing with Curl

You can easily use the command line to query for a single page of information from the Github API.

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: token <accessToken>"  -X GET -d '{"since":"2016-04-01T00:00:00"}' https://api.github.com/repos/<owner>/<repository>/commits  > commits.json
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: token <accessToken>" -X GET https://api.github.com/repos/<owner>/<repository>/contributors  > contributors.json
<br/>

If, however, you want all the data and the full power... use githubcontrib to get a list of contributors, supports 1..n pages of data, and will format the JSON as Markdown or HTML tables

node githubcontrib --owner angular --repository material --sha master --since 2016-04-01 --cols 6 --sortOrder desc --format md --showlogin true  > ../contributions.md

Bash Function

The following bash function is quite convenient:

function ghcontrib() {
  repo=$(basename $(pwd))
  githubcontrib --owner USER_NAME --repo $repo --cols 6 --showlogin true --filter gitter-badger --sortOrder desc | pbcopy
}

You can invoke it with:

ghcontrib

It assumes that you're in the project's directory, the directory is named after your project on GitHub and your username is USER_NAME.

The function will run githubcontrib and put the returned markdown in your clipboard.

GitHub Limit

The Github API has a 60-requests-per-hour rate-limit for non-authenticated use. If you need some more then a scope-limited Github OAuth token can be used to boost the limit to 5000.

License

MIT