Setup GitHub

by bradrydzewski

Drone comes with built-in support for GitHub and GitHub Enterprise. To enable GitHub you should configure the Drone container using the following environment variables:

version: '2'

services:
  drone-server:
    image: drone/drone:0.5
    environment:
+     DRONE_GITHUB=true
+     DRONE_GITHUB_CLIENT=95c0282573633eb25e82
+     DRONE_GITHUB_SECRET=30f5064039e6b359e075

Registration

Register your application with GitHub to create your client id and secret. It is very import the authorization callback URL matches your http(s) scheme and hostname exactly with /authorize as the path.

Please use this screenshot for reference:

github oauth setup

Configuration

This is a full list of configuration options. Please note that many of these options use default configuration values that should work for the majority of installations.

DRONE_GITHUB=true
Set to true to enable the GitHub driver.
DRONE_GITHUB_URL=https://github.com
GitHub server address.
DRONE_GITHUB_CLIENT
Github oauth2 client id.
DRONE_GITHUB_SECRET
Github oauth2 client secret.
DRONE_GITHUB_SCOPE=repo,repo:status,user:email,read:org
Comma-separated Github oauth scope.
DRONE_GITHUB_GIT_USERNAME
Optional. Use a single machine account username to clone all repositories.
DRONE_GITHUB_GIT_PASSWORD
Optional. Use a single machine account password to clone all repositories.
DRONE_GITHUB_PRIVATE_MODE=false
Set to true if Github is running in private mode.
DRONE_GITHUB_MERGE_REF=true
Set to true to use the refs/pulls/%d/merge vs refs/pulls/%d/head
DRONE_GITHUB_CONTEXT=continuous-integration/drone
Customize the GitHub status message context
DRONE_GITHUB_SKIP_VERIFY=false
Set to true to disable SSL verification.