thinkaurelius/cla-enforcer

Name: cla-enforcer

Owner: Aurelius

Description: A Contributor License Agreement enforcement bot

Created: 2015-09-01 18:25:02.0

Updated: 2015-09-01 18:25:05.0

Pushed: 2015-09-01 18:31:55.0

Homepage: null

Size: 347

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

CLA Enforcer

CLA Enforcer is a GitHub and DocuSign API integration to automate a CLA process for open source projects.

Installation
  1. Create a GitHub Application and optionally a GitHub account that will be used to leave comments on and tag pull requests. Specify your HOSTNAME as the Homepage URL and HOSTNAME/authorize as the Authorization callback URL.
  2. Sign up for the DocuSign API.
  3. Fork this repository.
  4. Modify the default views and templates as needed.
  5. Press the 'Deploy to Heroku' button below.

Deploy

Usage

After you've deployed CLA Enforcer to Heroku, it's time to enable it for the relevant repositories.

 install heroku
ku git:clone -a [yourappname]
yourappname]
ku run rake cla:enforce[username/repository]
ku run rake -D
Configuration

The CLA Enforcer comes with generic templates for the CLA form, and comment bodies. We expect you to customize them before deploying CLA Enforcer.

Templates

Templates are used when commenting on pull requests or generating a PDF file containing the CLA.

Views

Views are Sinatra templates that display information to the user.

ENV

CLA Enforcer is fully configurable via the environment variables described below.

Note that you can skip this section if you're using the 'Deploy to Heroku' button as you'll be prompted to specify these automatically.

Development

Note that the instructions below assume https://cla-enforcer.ngrok.com/ hostname, feel free to use any other hostname, this one is given as an example.

le install
k -log=stdout -subdomain cla-enforcer 3000
le exec dotenv bin/cla-enforcer
 https://cla-enforcer.ngrok.com/
How it works

CLA Enforcer is designed to easily run on Heroku's free tier. It consists of a Sinatra website served by Puma (Webapp) and a background worker (Worker) communicating over a Unix domain socket and sharing a PostgreSQL database (Database). You can easily have multiple instances of the API and Workers running across multiple Heroku dynos if necessary.

The Webapp is responsible for rendering views and receiving form submissions and webhooks. After validating webhooks and form submissions, the Webapp updates the Database when necessary and sends messages to the Worker.

The Worker generates PDF files with the CLA, comments on and tags pull requests with the 'cla-missing' label when necessary and processes status updates related to any in-progress CLA documents from DocuSign Connect API.

Creating a pull request

When a new pull request is created on a given repository, GitHub sends an HTTP request to CLA Enforcer's endpoint. CLA Enforcer's API processes the payload and sends a relevant message to the Worker.

The Worker checks if the author of the pull request is in the Database and has signed the CLA. If not, the worker leaves a comment on the newly created pull request using the request_signature.md.erb template and tags the pull request with a 'cla-missing' label.

Signing the CLA

When a contributor visits the Webapp in order to sign the CLA, they are required to sign in with their GitHub account via OAuth. This step validates the identity of the contributor, it doesn't require any extra permissions and uses only the public information of the contributor.

Once they've signed in, the Webapp displays a pre-filled form that includes their GitHub username, full name, email and company name. Upon submission of this form, the Webapp sends a message to the Worker.

The Worker generates a PDF file from the cla.html.erb template and emails it to the email address provided by the contributor using DocuSign's API. It also provides the Webapp's endpoint for document status change updates and stores the DocuSign identifier for the document in the Database.

Receiving status updates from DocuSign

When a document is sent, viewed or signed, the DocuSign API will send an HTTP request to a Webapp endpoint.

The Webapp will process the request payload and send a message to the Worker.

The Worker will update the status of the document in the Database. If the CLA has been completed, the worker will check the database for any pull requests that are pending signature from the contributor and will proceed to comment on them using the cla_signed.md.erb template as well as remove the 'cla-missing' labels.

License

Copyright 2015 DataStax, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.