File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 "supported" : true
2222 }
2323 },
24+ "contributes" : {
25+ "commands" : [
26+ {
27+ "command" : " che-api.test-github-proxy" ,
28+ "title" : " Test GitHub Proxy (axios)"
29+ }
30+ ]
31+ },
2432 "main" : " ./out/extension.js" ,
2533 "scripts" : {
2634 "compile" : " gulp compile-extension:che-api" ,
Original file line number Diff line number Diff line change @@ -79,5 +79,16 @@ export async function activate(_extensionContext: vscode.ExtensionContext): Prom
7979
8080 await container . get ( K8SServiceImpl ) . ensureKubernetesServiceHostWhitelisted ( ) ;
8181
82+ _extensionContext . subscriptions . push (
83+ vscode . commands . registerCommand ( 'che-api.test-github-proxy' , async ( ) => {
84+ try {
85+ const user = await githubService . getUser ( ) ;
86+ vscode . window . showInformationMessage ( `Success! GitHub user: ${ user . login } ` ) ;
87+ } catch ( e : any ) {
88+ vscode . window . showErrorMessage ( `Failed to get GitHub user: ${ e . message } ` ) ;
89+ }
90+ } )
91+ ) ;
92+
8293 return api ;
8394}
Original file line number Diff line number Diff line change @@ -195,6 +195,14 @@ export class GithubServiceImpl implements GithubService {
195195 private async initializeToken ( ) : Promise < void > {
196196 this . logger . info ( 'Github Service: extracting token...' ) ;
197197
198+ if ( process . env . GITHUB_TEST_TOKEN ) {
199+ this . token = process . env . GITHUB_TEST_TOKEN ;
200+ this . logger . info ( 'Github Service: using token from GITHUB_TEST_TOKEN env variable' ) ;
201+ return ;
202+ } else {
203+ this . logger . info ( 'Github Service: NO token from GITHUB_TEST_TOKEN env variable' ) ;
204+ }
205+
198206 const deviceAuthToken = await this . getDeviceAuthToken ( ) ;
199207 if ( deviceAuthToken ) {
200208 this . token = deviceAuthToken ;
You can’t perform that action at this time.
0 commit comments