@@ -82,6 +82,7 @@ class GithubScm extends Scm {
8282 * Constructor
8383 * @method constructor
8484 * @param {Object } options Configuration options
85+ * @param {Boolean } [options.privateRepo=false] Request 'repo' scope, which allows read/write access for public & private repos
8586 * @param {String } [options.gheHost=null] If using GitHub Enterprise, the host/port of the deployed instance
8687 * @param {String } [options.gheProtocol=https] If using GitHub Enterprise, the protocol to use
8788 * @param {Boolean } [options.https=false] Is the Screwdriver API running over HTTPS
@@ -96,6 +97,7 @@ class GithubScm extends Scm {
9697
9798 // Validate configuration
9899 this . config = joi . attempt ( config , joi . object ( ) . keys ( {
100+ privateRepo : joi . boolean ( ) . optional ( ) . default ( false ) ,
99101 gheProtocol : joi . string ( ) . optional ( ) . default ( 'https' ) ,
100102 gheHost : joi . string ( ) . optional ( ) . description ( 'GitHub Enterpise host' ) ,
101103 https : joi . boolean ( ) . optional ( ) . default ( false ) ,
@@ -694,11 +696,12 @@ class GithubScm extends Scm {
694696 * @return {Promise }
695697 */
696698 _getBellConfiguration ( ) {
699+ const scope = [ 'admin:repo_hook' , 'read:org' , 'repo:status' ] ;
697700 const bellConfig = {
698701 provider : 'github' ,
699702 clientId : this . config . oauthClientId ,
700703 clientSecret : this . config . oauthClientSecret ,
701- scope : [ 'admin:repo_hook' , 'read:org' , 'repo:status' ] ,
704+ scope : this . config . privateRepo === true ? scope . concat ( 'repo' ) : scope ,
702705 isSecure : this . config . https ,
703706 forceHttps : this . config . https
704707 } ;
0 commit comments