Skip to content

Commit 92a4054

Browse files
Help to test changes
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com> Assisted-by: Cursor AI
1 parent 97706e6 commit 92a4054

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

code/extensions/che-api/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
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",

code/extensions/che-api/src/extension.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

code/extensions/che-api/src/impl/github-service-impl.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)