File tree 4 files changed +11
-5
lines changed
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';
12
12
export class GithubApi extends Repo {
13
13
private octokit : any ;
14
14
15
- constructor ( token : string ) {
15
+ constructor ( baseUrl : string , token : string ) {
16
16
super ( "github" ) ;
17
+
18
+ if ( baseUrl === '' ) {
19
+ baseUrl = 'https://api.github.com' ;
20
+ }
21
+
17
22
this . octokit = new Octokit ( {
18
- auth : token
23
+ auth : token ,
24
+ baseUrl : baseUrl ,
19
25
} ) ;
20
26
}
21
27
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { GiteaApi } from './gitea';
6
6
7
7
describe ( 'GithubApi' , ( ) => {
8
8
it ( 'should load config' , ( ) => {
9
- const github = new GithubApi ( "token" ) ;
9
+ const github = new GithubApi ( '' , "token" ) ;
10
10
expect ( github ) . toBeTruthy ( ) ;
11
11
} ) ;
12
12
} ) ;
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ export class Kubero {
80
80
81
81
this . giteaApi = new GiteaApi ( process . env . GITEA_BASEURL as string , process . env . GITEA_PERSONAL_ACCESS_TOKEN as string ) ;
82
82
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 ) ;
84
84
this . gitlabApi = new GitlabApi ( process . env . GITLAB_BASEURL as string , process . env . GITLAB_PERSONAL_ACCESS_TOKEN as string ) ;
85
85
this . bitbucketApi = new BitbucketApi ( process . env . BITBUCKET_USERNAME as string , process . env . BITBUCKET_APP_PASSWORD as string ) ;
86
86
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export class Repositories {
16
16
constructor ( ) {
17
17
this . giteaApi = new GiteaApi ( process . env . GITEA_BASEURL as string , process . env . GITEA_PERSONAL_ACCESS_TOKEN as string ) ;
18
18
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 ) ;
20
20
this . gitlabApi = new GitlabApi ( process . env . GITLAB_BASEURL as string , process . env . GITLAB_PERSONAL_ACCESS_TOKEN as string ) ;
21
21
this . bitbucketApi = new BitbucketApi ( process . env . BITBUCKET_USERNAME as string , process . env . BITBUCKET_APP_PASSWORD as string ) ;
22
22
}
You can’t perform that action at this time.
0 commit comments