11import * as vscode from "vscode" ;
2- import { ActionsExplorerProvider as WorkflowsTreeProvider } from "./treeViews/workflows" ;
3- import { initResources } from "./treeViews/icons" ;
4- import { Workflow , WorkflowRun , Secret } from "./model" ;
5- import { join } from "path" ;
62import { setPAT } from "./auth/pat" ;
7- import { getWorkflowUri } from "./workflow/workflow" ;
8- import { OctokitWithActions } from "./typings/api" ;
93import { Protocol } from "./external/protocol" ;
10- import { SettingsTreeProvider } from "./treeViews/settings" ;
114import { encodeSecret } from "./secrets" ;
5+ import { initResources } from "./treeViews/icons" ;
6+ import { SettingsTreeProvider } from "./treeViews/settings" ;
7+ import { ActionsExplorerProvider as WorkflowsTreeProvider } from "./treeViews/workflows" ;
8+ import { getWorkflowUri } from "./workflow/workflow" ;
9+ import Octokit = require( "@octokit/rest" ) ;
10+ import { Workflow , WorkflowRun , Secret } from "./model" ;
1211
1312export function activate ( context : vscode . ExtensionContext ) {
1413 initResources ( context ) ;
@@ -60,7 +59,7 @@ export function activate(context: vscode.ExtensionContext) {
6059 } ) ;
6160 if ( event_type ) {
6261 const repo : Protocol = args . repo ;
63- const client : OctokitWithActions = args . client ;
62+ const client : Octokit = args . client ;
6463
6564 await client . repos . createDispatchEvent ( {
6665 owner : repo . owner ,
@@ -116,13 +115,13 @@ export function activate(context: vscode.ExtensionContext) {
116115 vscode . commands . registerCommand ( "workflow.run.rerun" , async args => {
117116 const repo : Protocol = args . repo ;
118117 const run : WorkflowRun = args . run ;
119- const client : OctokitWithActions = args . client ;
118+ const client : Octokit = args . client ;
120119
121120 try {
122- await client . actions . rerunWorkflow ( {
121+ await client . actions . reRunWorkflow ( {
123122 owner : repo . owner ,
124123 repo : repo . repositoryName ,
125- run : run . id
124+ run_id : run . id
126125 } ) ;
127126 } catch ( e ) {
128127 vscode . window . showErrorMessage (
@@ -138,13 +137,13 @@ export function activate(context: vscode.ExtensionContext) {
138137 vscode . commands . registerCommand ( "workflow.run.cancel" , async args => {
139138 const repo : Protocol = args . repo ;
140139 const run : WorkflowRun = args . run ;
141- const client : OctokitWithActions = args . client ;
140+ const client : Octokit = args . client ;
142141
143142 try {
144- await client . actions . cancelWorkflow ( {
143+ await client . actions . cancelWorkflowRun ( {
145144 owner : repo . owner ,
146145 repo : repo . repositoryName ,
147- run : run . id
146+ run_id : run . id
148147 } ) ;
149148 } catch ( e ) {
150149 vscode . window . showErrorMessage (
@@ -159,7 +158,7 @@ export function activate(context: vscode.ExtensionContext) {
159158 context . subscriptions . push (
160159 vscode . commands . registerCommand ( "settings.secret.add" , async args => {
161160 const repo : Protocol = args . repo ;
162- const client : OctokitWithActions = args . client ;
161+ const client : Octokit = args . client ;
163162
164163 const name = await vscode . window . showInputBox ( {
165164 prompt : "Enter name for new secret"
@@ -180,10 +179,10 @@ export function activate(context: vscode.ExtensionContext) {
180179 repo : repo . repositoryName
181180 } ) ;
182181
183- const key_id : string = keyResponse . data . key_id ;
184- const key : string = keyResponse . data . key ;
182+ const key_id = keyResponse . data . key_id ;
183+ const key = keyResponse . data . key ;
185184
186- await client . actions . setSecret ( {
185+ await client . actions . createOrUpdateSecretForRepo ( {
187186 owner : repo . owner ,
188187 repo : repo . repositoryName ,
189188 name : name ,
@@ -203,16 +202,13 @@ export function activate(context: vscode.ExtensionContext) {
203202 vscode . commands . registerCommand ( "settings.secret.delete" , async args => {
204203 const repo : Protocol = args . repo ;
205204 const secret : Secret = args . secret ;
206- const client : OctokitWithActions = args . client ;
205+ const client : Octokit = args . client ;
207206
208- // TODO: Make API call
209- // await client.actions.setSecret({
210- // owner: repo.owner,
211- // repo: repo.repositoryName,
212- // name: name,
213- // key_id: key_id,
214- // encrypted_value: encodeSecret(key, value)
215- // });
207+ await client . actions . deleteSecretFromRepo ( {
208+ owner : repo . owner ,
209+ repo : repo . repositoryName ,
210+ name : secret . name
211+ } ) ;
216212
217213 settingsTreeProvider . refresh ( ) ;
218214 } )
@@ -222,7 +218,7 @@ export function activate(context: vscode.ExtensionContext) {
222218 vscode . commands . registerCommand ( "settings.secret.update" , async args => {
223219 const repo : Protocol = args . repo ;
224220 const secret : Secret = args . secret ;
225- const client : OctokitWithActions = args . client ;
221+ const client : Octokit = args . client ;
226222
227223 const value = await vscode . window . showInputBox ( {
228224 prompt : "Enter the new secret value"
@@ -235,10 +231,10 @@ export function activate(context: vscode.ExtensionContext) {
235231 repo : repo . repositoryName
236232 } ) ;
237233
238- const key_id : string = keyResponse . data . key_id ;
239- const key : string = keyResponse . data . key ;
234+ const key_id = keyResponse . data . key_id ;
235+ const key = keyResponse . data . key ;
240236
241- await client . actions . setSecret ( {
237+ await client . actions . createOrUpdateSecretForRepo ( {
242238 owner : repo . owner ,
243239 repo : repo . repositoryName ,
244240 name : secret . name ,
0 commit comments