From 6030b46245e8e47a7a3db9d1a500aa35d053518b Mon Sep 17 00:00:00 2001 From: Taj Date: Sat, 6 Sep 2025 14:43:51 +0530 Subject: [PATCH] refactor: consolidate secrets and variables commands - Replaced separate commands for secrets and variables with unified commands. - Improved code structure and readability. - Simplified command registration. - Removed redundant code. - Enhanced maintainability. --- src/commands/secrets/addSecret.ts | 82 ---------------- src/commands/secrets/copySecret.ts | 14 --- src/commands/secrets/deleteSecret.ts | 41 -------- src/commands/secrets/updateSecret.ts | 29 ------ src/commands/settings/add.ts | 113 +++++++++++++++++++++++ src/commands/settings/copy.ts | 31 +++++++ src/commands/settings/delete.ts | 73 +++++++++++++++ src/commands/settings/update.ts | 89 ++++++++++++++++++ src/commands/variables/addVariable.ts | 55 ----------- src/commands/variables/copyVariable.ts | 24 ----- src/commands/variables/deleteVariable.ts | 41 -------- src/commands/variables/updateVariable.ts | 50 ---------- src/extension.ts | 29 +++--- 13 files changed, 319 insertions(+), 352 deletions(-) delete mode 100644 src/commands/secrets/addSecret.ts delete mode 100644 src/commands/secrets/copySecret.ts delete mode 100644 src/commands/secrets/deleteSecret.ts delete mode 100644 src/commands/secrets/updateSecret.ts create mode 100644 src/commands/settings/add.ts create mode 100644 src/commands/settings/copy.ts create mode 100644 src/commands/settings/delete.ts create mode 100644 src/commands/settings/update.ts delete mode 100644 src/commands/variables/addVariable.ts delete mode 100644 src/commands/variables/copyVariable.ts delete mode 100644 src/commands/variables/deleteVariable.ts delete mode 100644 src/commands/variables/updateVariable.ts diff --git a/src/commands/secrets/addSecret.ts b/src/commands/secrets/addSecret.ts deleted file mode 100644 index 39e30d8..0000000 --- a/src/commands/secrets/addSecret.ts +++ /dev/null @@ -1,82 +0,0 @@ -import * as vscode from "vscode"; -import {GitHubRepoContext} from "../../git/repository"; -import {encodeSecret} from "../../secrets"; -import {EnvironmentSecretsCommandArgs} from "../../treeViews/settings/environmentSecretsNode"; -import {RepoSecretsCommandArgs} from "../../treeViews/settings/repoSecretsNode"; - -type AddSecretCommandArgs = RepoSecretsCommandArgs | EnvironmentSecretsCommandArgs; - -export function registerAddSecret(context: vscode.ExtensionContext) { - context.subscriptions.push( - vscode.commands.registerCommand("github-actions.settings.secret.add", async (args: AddSecretCommandArgs) => { - const {gitHubRepoContext} = args; - - const name = await vscode.window.showInputBox({ - prompt: "Enter name for new secret", - ignoreFocusOut: true - }); - - if (!name) { - return; - } - - const value = await vscode.window.showInputBox({ - prompt: "Enter the new secret value", - ignoreFocusOut: true - }); - - if (!value) { - return; - } - - try { - if ("environment" in args) { - await createOrUpdateEnvSecret(gitHubRepoContext, args.environment.name, name, value); - } else { - await createOrUpdateRepoSecret(gitHubRepoContext, name, value); - } - } catch (e) { - await vscode.window.showErrorMessage((e as Error).message); - } - - await vscode.commands.executeCommand("github-actions.explorer.refresh"); - }) - ); -} - -export async function createOrUpdateRepoSecret(context: GitHubRepoContext, name: string, value: string) { - const keyResponse = await context.client.actions.getRepoPublicKey({ - owner: context.owner, - repo: context.name - }); - - await context.client.actions.createOrUpdateRepoSecret({ - owner: context.owner, - repo: context.name, - secret_name: name, - key_id: keyResponse.data.key_id, - encrypted_value: await encodeSecret(keyResponse.data.key, value) - }); -} - -export async function createOrUpdateEnvSecret( - context: GitHubRepoContext, - environment: string, - name: string, - value: string -) { - const keyResponse = await context.client.actions.getEnvironmentPublicKey({ - owner: context.owner, - repo: context.name, - environment_name: environment - }); - - await context.client.actions.createOrUpdateEnvironmentSecret({ - owner: context.owner, - repo: context.name, - environment_name: environment, - secret_name: name, - key_id: keyResponse.data.key_id, - encrypted_value: await encodeSecret(keyResponse.data.key, value) - }); -} diff --git a/src/commands/secrets/copySecret.ts b/src/commands/secrets/copySecret.ts deleted file mode 100644 index f3ed3ec..0000000 --- a/src/commands/secrets/copySecret.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as vscode from "vscode"; -import {SecretCommandArgs} from "../../treeViews/settings/secretNode"; - -export function registerCopySecret(context: vscode.ExtensionContext) { - context.subscriptions.push( - vscode.commands.registerCommand("github-actions.settings.secret.copy", async (args: SecretCommandArgs) => { - const {secret} = args; - - await vscode.env.clipboard.writeText(secret.name); - - vscode.window.setStatusBarMessage(`Copied ${secret.name}`, 2000); - }) - ); -} diff --git a/src/commands/secrets/deleteSecret.ts b/src/commands/secrets/deleteSecret.ts deleted file mode 100644 index bae63a1..0000000 --- a/src/commands/secrets/deleteSecret.ts +++ /dev/null @@ -1,41 +0,0 @@ -import * as vscode from "vscode"; -import {SecretCommandArgs} from "../../treeViews/settings/secretNode"; - -export function registerDeleteSecret(context: vscode.ExtensionContext) { - context.subscriptions.push( - vscode.commands.registerCommand("github-actions.settings.secret.delete", async (args: SecretCommandArgs) => { - const {gitHubRepoContext, secret, environment} = args; - - const acceptText = "Yes, delete this secret"; - try { - await vscode.window - .showInformationMessage( - `Are you sure you want to delete ${secret.name}?`, - {modal: true, detail: "Deleting this secret cannot be undone and may impact workflows in this repository"}, - acceptText - ) - .then(async answer => { - if (answer === acceptText) { - if (environment) { - await gitHubRepoContext.client.actions.deleteEnvironmentSecret({ - owner: gitHubRepoContext.owner, - repo: gitHubRepoContext.name, - environment_name: environment.name, - secret_name: secret.name - }); - } else { - await gitHubRepoContext.client.actions.deleteRepoSecret({ - owner: gitHubRepoContext.owner, - repo: gitHubRepoContext.name, - secret_name: secret.name - }); - } - } - }); - } catch (e) { - await vscode.window.showErrorMessage((e as Error).message); - } - await vscode.commands.executeCommand("github-actions.explorer.refresh"); - }) - ); -} diff --git a/src/commands/secrets/updateSecret.ts b/src/commands/secrets/updateSecret.ts deleted file mode 100644 index 051920c..0000000 --- a/src/commands/secrets/updateSecret.ts +++ /dev/null @@ -1,29 +0,0 @@ -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); - } - }) - ); -} diff --git a/src/commands/settings/add.ts b/src/commands/settings/add.ts new file mode 100644 index 0000000..67e97e1 --- /dev/null +++ b/src/commands/settings/add.ts @@ -0,0 +1,113 @@ + +import * as vscode from "vscode"; +import {GitHubRepoContext} from "../../git/repository"; +import {encodeSecret} from "../../secrets"; +import {EnvironmentSecretsCommandArgs} from "../../treeViews/settings/environmentSecretsNode"; +import {EnvironmentVariablesCommandArgs} from "../../treeViews/settings/environmentVariablesNode"; +import {RepoSecretsCommandArgs} from "../../treeViews/settings/repoSecretsNode"; +import {RepoVariablesCommandArgs} from "../../treeViews/settings/repoVariablesNode"; + +type AddCommandArgs = + | RepoSecretsCommandArgs + | EnvironmentSecretsCommandArgs + | RepoVariablesCommandArgs + | EnvironmentVariablesCommandArgs; + +type SettingType = "secret" | "variable"; + +export function registerAddSetting(context: vscode.ExtensionContext, type: SettingType) { + context.subscriptions.push( + vscode.commands.registerCommand( + `github-actions.settings.${type}.add`, + async (args: AddCommandArgs) => { + const {gitHubRepoContext} = args; + + const name = await vscode.window.showInputBox({ + prompt: `Enter name for new ${type}`, + ignoreFocusOut: true + }); + + if (!name) { + return; + } + + const value = await vscode.window.showInputBox({ + prompt: `Enter the new ${type} value`, + ignoreFocusOut: true + }); + + if (!value) { + return; + } + + try { + if (type === "secret") { + if ("environment" in args) { + await createOrUpdateEnvSecret(gitHubRepoContext, args.environment.name, name, value); + } else { + await createOrUpdateRepoSecret(gitHubRepoContext, name, value); + } + } else { + if ("environment" in args) { + await gitHubRepoContext.client.actions.createEnvironmentVariable({ + owner: gitHubRepoContext.owner, + repo: gitHubRepoContext.name, + environment_name: args.environment.name, + name, + value + }); + } else { + await gitHubRepoContext.client.actions.createRepoVariable({ + owner: gitHubRepoContext.owner, + repo: gitHubRepoContext.name, + name, + value + }); + } + } + } catch (e) { + await vscode.window.showErrorMessage((e as Error).message); + } + + await vscode.commands.executeCommand("github-actions.explorer.refresh"); + } + ) + ); +} + +export async function createOrUpdateRepoSecret(context: GitHubRepoContext, name: string, value: string) { + const keyResponse = await context.client.actions.getRepoPublicKey({ + owner: context.owner, + repo: context.name + }); + + await context.client.actions.createOrUpdateRepoSecret({ + owner: context.owner, + repo: context.name, + secret_name: name, + key_id: keyResponse.data.key_id, + encrypted_value: await encodeSecret(keyResponse.data.key, value) + }); +} + +export async function createOrUpdateEnvSecret( + context: GitHubRepoContext, + environment: string, + name: string, + value: string +) { + const keyResponse = await context.client.actions.getEnvironmentPublicKey({ + owner: context.owner, + repo: context.name, + environment_name: environment + }); + + await context.client.actions.createOrUpdateEnvironmentSecret({ + owner: context.owner, + repo: context.name, + environment_name: environment, + secret_name: name, + key_id: keyResponse.data.key_id, + encrypted_value: await encodeSecret(keyResponse.data.key, value) + }); +} diff --git a/src/commands/settings/copy.ts b/src/commands/settings/copy.ts new file mode 100644 index 0000000..f36f984 --- /dev/null +++ b/src/commands/settings/copy.ts @@ -0,0 +1,31 @@ + +import * as vscode from "vscode"; +import {SecretCommandArgs} from "../../treeViews/settings/secretNode"; +import {VariableCommandArgs} from "../../treeViews/settings/variableNode"; + +type CopyCommandArgs = SecretCommandArgs | VariableCommandArgs; +type SettingType = "secret" | "variable"; +type CopyPart = "name" | "value"; + +export function registerCopySetting(context: vscode.ExtensionContext, type: SettingType, part?: CopyPart) { + const command = part ? `github-actions.settings.${type}.copy-${part}` : `github-actions.settings.${type}.copy`; + + context.subscriptions.push( + vscode.commands.registerCommand(command, async (args: CopyCommandArgs) => { + let value: string; + if (type === "secret") { + value = (args as SecretCommandArgs).secret.name; + } else { + if (part === "name") { + value = (args as VariableCommandArgs).variable.name; + } else { + value = (args as VariableCommandArgs).variable.value; + } + } + + await vscode.env.clipboard.writeText(value); + + vscode.window.setStatusBarMessage(`Copied ${value}`, 2000); + }) + ); +} diff --git a/src/commands/settings/delete.ts b/src/commands/settings/delete.ts new file mode 100644 index 0000000..9f75b5c --- /dev/null +++ b/src/commands/settings/delete.ts @@ -0,0 +1,73 @@ + +import * as vscode from "vscode"; +import {SecretCommandArgs} from "../../treeViews/settings/secretNode"; +import {VariableCommandArgs} from "../../treeViews/settings/variableNode"; + +type DeleteCommandArgs = SecretCommandArgs | VariableCommandArgs; +type SettingType = "secret" | "variable"; + +export function registerDeleteSetting(context: vscode.ExtensionContext, type: SettingType) { + context.subscriptions.push( + vscode.commands.registerCommand( + `github-actions.settings.${type}.delete`, + async (args: DeleteCommandArgs) => { + const {gitHubRepoContext, environment} = args; + + let name: string; + if (type === "secret") { + name = (args as SecretCommandArgs).secret.name; + } else { + name = (args as VariableCommandArgs).variable.name; + } + + const acceptText = `Yes, delete this ${type}`; + try { + await vscode.window + .showInformationMessage( + `Are you sure you want to delete ${name}?`, + { + modal: true, + detail: `Deleting this ${type} cannot be undone and may impact workflows in this repository` + }, + acceptText + ) + .then(async answer => { + if (answer === acceptText) { + if (type === "secret") { + if (environment) { + await gitHubRepoContext.client.actions.deleteEnvironmentSecret({ + owner: gitHubRepoContext.owner, + repo: gitHubRepoContext.name, + environment_name: environment.name, + secret_name: name + }); + } else { + await gitHubRepoContext.client.actions.deleteRepoSecret({ + owner: gitHubRepoContext.owner, + repo: gitHubRepoContext.name, + secret_name: name + }); + } + } else { + if (environment) { + await gitHubRepoContext.client.request( + `DELETE /repositories/${gitHubRepoContext.id}/environments/${environment.name}/variables/${name}` + ); + } else { + await gitHubRepoContext.client.actions.deleteRepoVariable({ + owner: gitHubRepoContext.owner, + repo: gitHubRepoContext.name, + name: name + }); + } + } + } + }); + } catch (e) { + await vscode.window.showErrorMessage((e as Error).message); + } + await vscode.commands.executeCommand("github-actions.explorer.refresh"); + } + ) + ); +} diff --git a/src/commands/settings/update.ts b/src/commands/settings/update.ts new file mode 100644 index 0000000..b005701 --- /dev/null +++ b/src/commands/settings/update.ts @@ -0,0 +1,89 @@ + +import * as vscode from "vscode"; +import {SecretCommandArgs} from "../../treeViews/settings/secretNode"; +import {VariableCommandArgs} from "../../treeViews/settings/variableNode"; +import {createOrUpdateEnvSecret, createOrUpdateRepoSecret} from "./add"; + +type UpdateCommandArgs = SecretCommandArgs | VariableCommandArgs; +type SettingType = "secret" | "variable"; + +export function registerUpdateSetting(context: vscode.ExtensionContext, type: SettingType) { + context.subscriptions.push( + vscode.commands.registerCommand( + `github-actions.settings.${type}.update`, + async (args: UpdateCommandArgs) => { + if (type === "secret") { + await updateSecret(args as SecretCommandArgs); + } else { + await updateVariable(args as VariableCommandArgs); + } + } + ) + ); +} + +async function updateSecret(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); + } +} + +async function updateVariable(args: VariableCommandArgs) { + const {gitHubRepoContext, variable, environment} = args; + + const name = await vscode.window.showInputBox({ + prompt: "Enter the new variable name", + value: variable.name + }); + + const value = await vscode.window.showInputBox({ + prompt: "Enter the new variable value", + value: variable.value + }); + + if (name == variable.name && value == variable.value) { + return; + } + + const payload: {name?: string; value?: string} = {}; + if (name != variable.name) { + payload.name = name; + } + if (value != variable.value) { + payload.value = value; + } + + try { + if (environment) { + await gitHubRepoContext.client.request( + `PATCH /repositories/${gitHubRepoContext.id}/environments/${environment.name}/variables/${variable.name}`, + payload + ); + } else { + await gitHubRepoContext.client.request( + `PATCH /repos/${gitHubRepoContext.owner}/${gitHubRepoContext.name}/actions/variables/${variable.name}`, + payload + ); + } + } catch (e) { + await vscode.window.showErrorMessage((e as Error).message); + } + + await vscode.commands.executeCommand("github-actions.explorer.refresh"); +} diff --git a/src/commands/variables/addVariable.ts b/src/commands/variables/addVariable.ts deleted file mode 100644 index 318350a..0000000 --- a/src/commands/variables/addVariable.ts +++ /dev/null @@ -1,55 +0,0 @@ -import * as vscode from "vscode"; -import {EnvironmentVariablesCommandArgs} from "../../treeViews/settings/environmentVariablesNode"; -import {RepoVariablesCommandArgs} from "../../treeViews/settings/repoVariablesNode"; - -type Args = RepoVariablesCommandArgs | EnvironmentVariablesCommandArgs; - -export function registerAddVariable(context: vscode.ExtensionContext) { - context.subscriptions.push( - vscode.commands.registerCommand("github-actions.settings.variable.add", async (args: Args) => { - const {gitHubRepoContext} = args; - - const name = await vscode.window.showInputBox({ - prompt: "Enter name for new variable", - placeHolder: "Variable name", - ignoreFocusOut: true - }); - - if (!name) { - return; - } - - const value = await vscode.window.showInputBox({ - prompt: "Enter the new variable value", - ignoreFocusOut: true - }); - - if (!value) { - return; - } - - try { - if ("environment" in args) { - await gitHubRepoContext.client.actions.createEnvironmentVariable({ - owner: gitHubRepoContext.owner, - repo: gitHubRepoContext.name, - environment_name: args.environment.name, - name, - value - }); - } else { - await gitHubRepoContext.client.actions.createRepoVariable({ - owner: gitHubRepoContext.owner, - repo: gitHubRepoContext.name, - name, - value - }); - } - } catch (e) { - await vscode.window.showErrorMessage((e as Error).message); - } - - await vscode.commands.executeCommand("github-actions.explorer.refresh"); - }) - ); -} diff --git a/src/commands/variables/copyVariable.ts b/src/commands/variables/copyVariable.ts deleted file mode 100644 index 41acc9c..0000000 --- a/src/commands/variables/copyVariable.ts +++ /dev/null @@ -1,24 +0,0 @@ -import * as vscode from "vscode"; -import {VariableCommandArgs} from "../../treeViews/settings/variableNode"; - -export function registerCopyVariable(context: vscode.ExtensionContext) { - context.subscriptions.push( - vscode.commands.registerCommand("github-actions.settings.variable.copy-name", async (args: VariableCommandArgs) => { - const {variable} = args; - - await vscode.env.clipboard.writeText(variable.name); - - vscode.window.setStatusBarMessage(`Copied ${variable.name}`, 2000); - }), - vscode.commands.registerCommand( - "github-actions.settings.variable.copy-value", - async (args: VariableCommandArgs) => { - const {variable} = args; - - await vscode.env.clipboard.writeText(variable.value); - - vscode.window.setStatusBarMessage(`Copied ${variable.value}`, 2000); - } - ) - ); -} diff --git a/src/commands/variables/deleteVariable.ts b/src/commands/variables/deleteVariable.ts deleted file mode 100644 index 4e8b673..0000000 --- a/src/commands/variables/deleteVariable.ts +++ /dev/null @@ -1,41 +0,0 @@ -import * as vscode from "vscode"; -import {VariableCommandArgs} from "../../treeViews/settings/variableNode"; - -export function registerDeleteVariable(context: vscode.ExtensionContext) { - context.subscriptions.push( - vscode.commands.registerCommand("github-actions.settings.variable.delete", async (args: VariableCommandArgs) => { - const {gitHubRepoContext, variable, environment} = args; - const acceptText = "Yes, delete this variable"; - - try { - await vscode.window - .showInformationMessage( - `Are you sure you want to delete ${variable.name}?`, - { - modal: true, - detail: "Deleting this variable cannot be undone and may impact workflows in this repository" - }, - acceptText - ) - .then(async answer => { - if (answer === acceptText) { - if (environment) { - await gitHubRepoContext.client.request( - `DELETE /repositories/${gitHubRepoContext.id}/environments/${environment.name}/variables/${variable.name}` - ); - } else { - await gitHubRepoContext.client.actions.deleteRepoVariable({ - owner: gitHubRepoContext.owner, - repo: gitHubRepoContext.name, - name: variable.name - }); - } - } - }); - } catch (e) { - await vscode.window.showErrorMessage((e as Error).message); - } - await vscode.commands.executeCommand("github-actions.explorer.refresh"); - }) - ); -} diff --git a/src/commands/variables/updateVariable.ts b/src/commands/variables/updateVariable.ts deleted file mode 100644 index 369e260..0000000 --- a/src/commands/variables/updateVariable.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as vscode from "vscode"; -import {VariableCommandArgs} from "../../treeViews/settings/variableNode"; - -export function registerUpdateVariable(context: vscode.ExtensionContext) { - context.subscriptions.push( - vscode.commands.registerCommand("github-actions.settings.variable.update", async (args: VariableCommandArgs) => { - const {gitHubRepoContext, variable, environment} = args; - - const name = await vscode.window.showInputBox({ - prompt: "Enter the new variable name", - value: variable.name - }); - - const value = await vscode.window.showInputBox({ - prompt: "Enter the new variable value", - value: variable.value - }); - - if (name == variable.name && value == variable.value) { - return; - } - - const payload: {name?: string; value?: string} = {}; - if (name != variable.name) { - payload.name = name; - } - if (value != variable.value) { - payload.value = value; - } - - try { - if (environment) { - await gitHubRepoContext.client.request( - `PATCH /repositories/${gitHubRepoContext.id}/environments/${environment.name}/variables/${variable.name}`, - payload - ); - } else { - await gitHubRepoContext.client.request( - `PATCH /repos/${gitHubRepoContext.owner}/${gitHubRepoContext.name}/actions/variables/${variable.name}`, - payload - ); - } - } catch (e) { - await vscode.window.showErrorMessage((e as Error).message); - } - - await vscode.commands.executeCommand("github-actions.explorer.refresh"); - }) - ); -} diff --git a/src/extension.ts b/src/extension.ts index 210c954..2654ef8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -9,16 +9,12 @@ import {registerOpenWorkflowStepLogs} from "./commands/openWorkflowStepLogs"; import {registerOpenWorkflowRun} from "./commands/openWorkflowRun"; import {registerPinWorkflow} from "./commands/pinWorkflow"; import {registerReRunWorkflowRun} from "./commands/rerunWorkflowRun"; -import {registerAddSecret} from "./commands/secrets/addSecret"; -import {registerCopySecret} from "./commands/secrets/copySecret"; -import {registerDeleteSecret} from "./commands/secrets/deleteSecret"; -import {registerUpdateSecret} from "./commands/secrets/updateSecret"; +import {registerAddSetting} from "./commands/settings/add"; +import {registerCopySetting} from "./commands/settings/copy"; +import {registerDeleteSetting} from "./commands/settings/delete"; +import {registerUpdateSetting} from "./commands/settings/update"; import {registerTriggerWorkflowRun} from "./commands/triggerWorkflowRun"; import {registerUnPinWorkflow} from "./commands/unpinWorkflow"; -import {registerAddVariable} from "./commands/variables/addVariable"; -import {registerCopyVariable} from "./commands/variables/copyVariable"; -import {registerDeleteVariable} from "./commands/variables/deleteVariable"; -import {registerUpdateVariable} from "./commands/variables/updateVariable"; import {initConfiguration} from "./configuration/configuration"; import {getGitHubContext} from "./git/repository"; import {init as initLogger, log, revealLog} from "./log"; @@ -77,15 +73,16 @@ export async function activate(context: vscode.ExtensionContext) { registerReRunWorkflowRun(context); registerCancelWorkflowRun(context); - registerAddSecret(context); - registerDeleteSecret(context); - registerCopySecret(context); - registerUpdateSecret(context); + registerAddSetting(context, "secret"); + registerDeleteSetting(context, "secret"); + registerCopySetting(context, "secret"); + registerUpdateSetting(context, "secret"); - registerAddVariable(context); - registerUpdateVariable(context); - registerDeleteVariable(context); - registerCopyVariable(context); + registerAddSetting(context, "variable"); + registerUpdateSetting(context, "variable"); + registerDeleteSetting(context, "variable"); + registerCopySetting(context, "variable", "name"); + registerCopySetting(context, "variable", "value"); registerPinWorkflow(context); registerUnPinWorkflow(context);