11'use strict' ;
22
33const axios = require ( 'axios' ) ;
4- const config = require ( '../../.config' ) ;
54const { createTokenAuth } = require ( '@octokit/auth-token' ) ;
65
76const host = 'https://api.github.com' ;
87
8+ const githubAccessTokenForMongoose = process . env . GITHUB_ACCESS_TOKEN_FOR_MONGOOSE ;
9+
910module . exports = {
1011 async createRelease ( tagAndName , body ) {
1112 const url = host + '/repos/Automattic/mongoose/releases' ;
@@ -14,7 +15,7 @@ module.exports = {
1415 name : tagAndName ,
1516 body : body ,
1617 } ;
17- const { token } = await createTokenAuth ( config . githubAccessTokenForMongoose ) ( ) ;
18+ const { token } = await createTokenAuth ( githubAccessTokenForMongoose ) ( ) ;
1819 const headers = {
1920 authorization : `bearer ${ token } ` ,
2021 accept : 'application/vnd.github.v3+json'
@@ -37,7 +38,7 @@ module.exports = {
3738 } ;
3839 return axios . get ( 'https://api.github.com/user' , { headers } ) . then ( res => res . data ) ;
3940 } ,
40- getAccessToken ( code ) {
41+ /* getAccessToken(code) {
4142 const body = {
4243 client_id: config.githubOAuthClientId,
4344 client_secret: config.githubOAuthClientSecret,
@@ -46,7 +47,7 @@ module.exports = {
4647 const opts = { headers: { accept: 'application/json' } };
4748 return axios.post(`https://github.com/login/oauth/access_token`, body, opts).
4849 then(res => res.data);
49- } ,
50+ },*/
5051 getChangelog ( params ) {
5152 const branch = params && params . branch || 'master' ;
5253 const url = host + '/repos/Automattic/mongoose/contents/CHANGELOG.md?ref=' + branch ;
@@ -56,7 +57,7 @@ module.exports = {
5657 return axios . get ( url , { headers } ) . then ( ( res ) => res . data ) ;
5758 } ,
5859 async getOrganizationId ( organizationName ) {
59- const { token } = await createTokenAuth ( config . githubAccessTokenForMongoose ) ( ) ;
60+ const { token } = await createTokenAuth ( githubAccessTokenForMongoose ) ( ) ;
6061 const headers = {
6162 authorization : `bearer ${ token } ` ,
6263 accept : 'application/vnd.github.v3+json'
@@ -65,7 +66,7 @@ module.exports = {
6566 return axios . get ( `https://api.github.com/orgs/${ name } ` , { headers } ) . then ( res => res . data . id ) ;
6667 } ,
6768 async getOrganizationMembers ( organizationName ) {
68- const { token } = await createTokenAuth ( config . githubAccessTokenForMongoose ) ( ) ;
69+ const { token } = await createTokenAuth ( githubAccessTokenForMongoose ) ( ) ;
6970 const headers = {
7071 authorization : `bearer ${ token } ` ,
7172 accept : 'application/vnd.github.v3+json'
0 commit comments