File tree Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,16 @@ import { RequestError } from '@octokit/types';
1212export class GithubApi extends Repo {
1313 private octokit : any ;
1414
15- constructor ( token : string ) {
15+ constructor ( baseUrl : string , token : string ) {
1616 super ( "github" ) ;
17+
18+ if ( baseUrl === '' ) {
19+ baseUrl = 'https://api.github.com' ;
20+ }
21+
1722 this . octokit = new Octokit ( {
18- auth : token
23+ auth : token ,
24+ baseUrl : baseUrl ,
1925 } ) ;
2026 }
2127
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { GiteaApi } from './gitea';
66
77describe ( 'GithubApi' , ( ) => {
88 it ( 'should load config' , ( ) => {
9- const github = new GithubApi ( "token" ) ;
9+ const github = new GithubApi ( '' , "token" ) ;
1010 expect ( github ) . toBeTruthy ( ) ;
1111 } ) ;
1212} ) ;
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ export class Kubero {
8080
8181 this . giteaApi = new GiteaApi ( process . env . GITEA_BASEURL as string , process . env . GITEA_PERSONAL_ACCESS_TOKEN as string ) ;
8282 this . gogsApi = new GogsApi ( process . env . GOGS_BASEURL as string , process . env . GOGS_PERSONAL_ACCESS_TOKEN as string ) ;
83- this . githubApi = new GithubApi ( process . env . GITHUB_PERSONAL_ACCESS_TOKEN as string ) ;
83+ this . githubApi = new GithubApi ( process . env . GITHUB_BASEURL as string , process . env . GITHUB_PERSONAL_ACCESS_TOKEN as string ) ;
8484 this . gitlabApi = new GitlabApi ( process . env . GITLAB_BASEURL as string , process . env . GITLAB_PERSONAL_ACCESS_TOKEN as string ) ;
8585 this . bitbucketApi = new BitbucketApi ( process . env . BITBUCKET_USERNAME as string , process . env . BITBUCKET_APP_PASSWORD as string ) ;
8686
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export class Repositories {
1616 constructor ( ) {
1717 this . giteaApi = new GiteaApi ( process . env . GITEA_BASEURL as string , process . env . GITEA_PERSONAL_ACCESS_TOKEN as string ) ;
1818 this . gogsApi = new GogsApi ( process . env . GOGS_BASEURL as string , process . env . GOGS_PERSONAL_ACCESS_TOKEN as string ) ;
19- this . githubApi = new GithubApi ( process . env . GITHUB_PERSONAL_ACCESS_TOKEN as string ) ;
19+ this . githubApi = new GithubApi ( process . env . GITHUB_BASEURL as string , process . env . GITHUB_PERSONAL_ACCESS_TOKEN as string ) ;
2020 this . gitlabApi = new GitlabApi ( process . env . GITLAB_BASEURL as string , process . env . GITLAB_PERSONAL_ACCESS_TOKEN as string ) ;
2121 this . bitbucketApi = new BitbucketApi ( process . env . BITBUCKET_USERNAME as string , process . env . BITBUCKET_APP_PASSWORD as string ) ;
2222 }
You can’t perform that action at this time.
0 commit comments