People ❤️ GitHub Contributions. However, it's not always simple to tell why a commit isn't counted as a contribution. This library lets you check whether a specific commit qualifies as a contribution.
To start working on the project:
script/bootstrap
To run the specs:
script/test
require "contribution-checker"
checker = ContributionChecker::Checker.new \
:access_token => "<Your 40 char GitHub API token>",
:commit_url => "https://github.com/user/repo/commit/sha"
checker.check
=> {
:contribution => true,
:and_criteria => {
:commit_email_is_not_generic => true,
:commit_in_valid_branch => true,
:repo_not_a_fork => true,
:commit_email_linked_to_user => true,
:commit_email => "[email protected]",
:default_branch => "master"
},
:or_criteria => {
:user_has_starred_repo => false,
:user_can_push_to_repo => false,
:user_is_repo_org_member => true,
:user_has_fork_of_repo => false,
:user_has_opened_issue_or_pr_in_repo => false
}
}
You might like to try out the Contribution Checker app built on top of this library:
The source for the app is in jdennes/contribution-checker-app.
Created by @izuzak and @jdennes at the Hamburg Hackathon, June 2014.