-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathupdateSecret.ts
More file actions
29 lines (25 loc) · 975 Bytes
/
updateSecret.ts
File metadata and controls
29 lines (25 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import * as vscode from "vscode";
import {SecretCommandArgs} from "../../treeViews/settings/secretNode";
import {createOrUpdateEnvSecret, createOrUpdateRepoSecret} from "./addSecret";
export function registerUpdateSecret(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand("github-actions.settings.secret.update", async (args: SecretCommandArgs) => {
const {gitHubRepoContext, secret, environment} = args;
const value = await vscode.window.showInputBox({
prompt: "Enter the new secret value"
});
if (!value) {
return;
}
try {
if (environment) {
await createOrUpdateEnvSecret(gitHubRepoContext, environment.name, secret.name, value);
} else {
await createOrUpdateRepoSecret(gitHubRepoContext, secret.name, value);
}
} catch (e) {
await vscode.window.showErrorMessage((e as Error).message);
}
})
);
}