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 @@ -81,5 +81,16 @@ export async function activate(_extensionContext: vscode.ExtensionContext): Prom
8181
8282 await container . get ( K8SServiceImpl ) . ensureKubernetesServiceHostWhitelisted ( ) ;
8383
84+ _extensionContext . subscriptions . push (
85+ vscode . commands . registerCommand ( 'che-api.test-github-proxy' , async ( ) => {
86+ try {
87+ const user = await githubService . getUser ( ) ;
88+ vscode . window . showInformationMessage ( `Success! GitHub user: ${ user . login } ` ) ;
89+ } catch ( e : any ) {
90+ vscode . window . showErrorMessage ( `Failed to get GitHub user: ${ e . message } ` ) ;
91+ }
92+ } )
93+ ) ;
94+
8495 return api ;
8596}
Original file line number Diff line number Diff line change @@ -61,6 +61,14 @@ export class GithubServiceImpl implements GithubService {
6161 private async initializeToken ( ) : Promise < void > {
6262 this . logger . info ( 'Github Service: extracting token...' ) ;
6363
64+ if ( process . env . GITHUB_TEST_TOKEN ) {
65+ this . token = process . env . GITHUB_TEST_TOKEN ;
66+ this . logger . info ( 'Github Service: using token from GITHUB_TEST_TOKEN env variable' ) ;
67+ return ;
68+ } else {
69+ this . logger . info ( 'Github Service: NO token from GITHUB_TEST_TOKEN env variable' ) ;
70+ }
71+
6472 const deviceAuthToken = await this . getDeviceAuthToken ( ) ;
6573 if ( deviceAuthToken ) {
6674 this . token = deviceAuthToken ;
You can’t perform that action at this time.
0 commit comments