File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 192192 "light" : " resources/icons/light/edit.svg"
193193 }
194194 },
195+ {
196+ "command" : " github-actions.settings.variable.delete" ,
197+ "category" : " GitHub Actions" ,
198+ "title" : " Update variable" ,
199+ "icon" : {
200+ "dark" : " resources/icons/dark/remove.svg" ,
201+ "light" : " resources/icons/light/remove.svg"
202+ }
203+ },
195204 {
196205 "command" : " github-actions.workflow.pin" ,
197206 "category" : " GitHub Actions" ,
331340 },
332341 {
333342 "command" : " github-actions.settings.variable.update" ,
334- "group" : " inline" ,
343+ "group" : " inline@1" ,
344+ "when" : " viewItem == 'repo-variable' || viewItem == 'env-variable'"
345+ },
346+ {
347+ "command" : " github-actions.settings.variable.delete" ,
348+ "group" : " inline@2" ,
335349 "when" : " viewItem == 'repo-variable' || viewItem == 'env-variable'"
336350 },
337351 {
385399 "command" : " github-actions.settings.variable.update" ,
386400 "when" : " false"
387401 },
402+ {
403+ "command" : " github-actions.settings.variable.delete" ,
404+ "when" : " false"
405+ },
388406 {
389407 "command" : " github-actions.workflow.pin" ,
390408 "when" : " false"
Original file line number Diff line number Diff line change 1+ import * as vscode from "vscode" ;
2+ import { VariableCommandArgs } from "../../treeViews/settings/variableNode" ;
3+
4+ export function registerDeleteVariable ( context : vscode . ExtensionContext ) {
5+ context . subscriptions . push (
6+ vscode . commands . registerCommand ( "github-actions.settings.variable.delete" , async ( args : VariableCommandArgs ) => {
7+ const { gitHubRepoContext, variable, environment} = args ;
8+
9+ try {
10+ if ( environment ) {
11+ await gitHubRepoContext . client . request (
12+ `DELETE /repositories/${ gitHubRepoContext . id } /environments/${ environment . name } /variables/${ variable . name } `
13+ ) ;
14+ } else {
15+ await gitHubRepoContext . client . actions . deleteRepoVariable ( {
16+ owner : gitHubRepoContext . owner ,
17+ repo : gitHubRepoContext . name ,
18+ name : variable . name
19+ } ) ;
20+ }
21+ } catch ( e ) {
22+ await vscode . window . showErrorMessage ( ( e as Error ) . message ) ;
23+ }
24+
25+ await vscode . commands . executeCommand ( "github-actions.explorer.refresh" ) ;
26+ } )
27+ ) ;
28+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {registerUpdateSecret} from "./commands/secrets/updateSecret";
1515import { registerTriggerWorkflowRun } from "./commands/triggerWorkflowRun" ;
1616import { registerUnPinWorkflow } from "./commands/unpinWorkflow" ;
1717import { registerAddVariable } from "./commands/variables/addVariable" ;
18+ import { registerDeleteVariable } from "./commands/variables/deleteVariable" ;
1819import { registerUpdateVariable } from "./commands/variables/updateVariable" ;
1920import { initConfiguration } from "./configuration/configuration" ;
2021import { getGitHubContext } from "./git/repository" ;
@@ -66,6 +67,7 @@ export async function activate(context: vscode.ExtensionContext) {
6667
6768 registerAddVariable ( context ) ;
6869 registerUpdateVariable ( context ) ;
70+ registerDeleteVariable ( context ) ;
6971
7072 registerPinWorkflow ( context ) ;
7173 registerUnPinWorkflow ( context ) ;
You can’t perform that action at this time.
0 commit comments