Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 464538c

Browse files
committed
fix: readd github enterpise token command
Fix erroneous removal of github enterprise token command. Closes #203
1 parent 8be58ac commit 464538c

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

src/commands/token.ts

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class SetGithubToken extends Command {
1313
private context: vscode.ExtensionContext;
1414

1515
@inject
16-
private githubManager: WorkflowManager;
16+
private workflowManager: WorkflowManager;
1717

1818
public async run(): Promise<void> {
1919
this.track('execute');
@@ -30,7 +30,44 @@ export class SetGithubToken extends Command {
3030
provider: 'github'
3131
};
3232
this.context.globalState.update('tokens', tokens);
33-
await this.githubManager.connect(tokens);
33+
await this.workflowManager.connect(tokens);
34+
}
35+
}
36+
37+
}
38+
39+
@component({eager: true})
40+
export class SetGithubEnterpriseToken extends Command {
41+
42+
public id = 'vscode-github.setGitHubEnterpriseToken';
43+
44+
@inject('vscode.ExtensionContext')
45+
private context: vscode.ExtensionContext;
46+
47+
@inject
48+
private workflowManager: WorkflowManager;
49+
50+
public async run(): Promise<void> {
51+
this.track('execute');
52+
const hostInput = await vscode.window.showInputBox({
53+
ignoreFocusOut: true,
54+
placeHolder: 'GitHub Enterprise Hostname'
55+
});
56+
if (hostInput) {
57+
const tokenInput = await vscode.window.showInputBox({
58+
ignoreFocusOut: true,
59+
password: true,
60+
placeHolder: 'GitHub Enterprise Token'
61+
});
62+
if (tokenInput) {
63+
const tokens = this.context.globalState.get<Tokens>('tokens', {});
64+
tokens[hostInput] = {
65+
token: tokenInput,
66+
provider: 'github'
67+
};
68+
this.context.globalState.update('tokens', tokens);
69+
this.workflowManager.connect(tokens);
70+
}
3471
}
3572
}
3673

0 commit comments

Comments
 (0)