Skip to content

Commit 738bcbb

Browse files
committed
Support setting getting & setting secrets
1 parent 940fc1a commit 738bcbb

File tree

11 files changed

+335
-45
lines changed

11 files changed

+335
-45
lines changed

package-lock.json

Lines changed: 68 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,29 @@
6464
"command": "workflow.run.cancel",
6565
"title": "Cancel workflow run",
6666
"when": "viewItem =~ /run/ && viewItem =~ /cancelable/"
67+
},
68+
{
69+
"command": "settings.secret.update",
70+
"title": "Update secret",
71+
"when": "viewItem == 'secret'"
6772
}
6873
],
6974
"views": {
70-
"actions-explorer": [
75+
"actions": [
7176
{
72-
"id": "actionsExplorer",
77+
"id": "workflows",
7378
"name": "Workflows"
79+
},
80+
{
81+
"id": "settings",
82+
"name": "Settings"
7483
}
7584
]
7685
},
7786
"viewsContainers": {
7887
"activitybar": [
7988
{
80-
"id": "actions-explorer",
89+
"id": "actions",
8190
"title": "GitHub Actions",
8291
"icon": "resources/icons/light/explorer.svg"
8392
}
@@ -87,7 +96,8 @@
8796
"view/title": [
8897
{
8998
"command": "explorer.refresh",
90-
"group": "navigation"
99+
"group": "navigation",
100+
"when": "view == workflows"
91101
}
92102
],
93103
"view/item/context": [
@@ -110,6 +120,10 @@
110120
{
111121
"command": "workflow.run.rerun",
112122
"when": "viewItem =~ /run/ && viewItem =~ /rerunnable/"
123+
},
124+
{
125+
"command": "settings.secret.update",
126+
"when": "viewItem == 'secret'"
113127
}
114128
]
115129
}
@@ -141,11 +155,15 @@
141155
},
142156
"dependencies": {
143157
"@octokit/rest": "^16.35.2",
158+
"atob": "^2.1.2",
159+
"btoa": "^1.2.1",
144160
"js-yaml": "^3.13.1",
145161
"keytar": "^5.0.0",
146162
"ssh-config": "^3.0.0",
147163
"tunnel": "0.0.6",
164+
"tweetsodium": "0.0.4",
165+
"util": "^0.12.1",
148166
"uuid": "^3.3.3",
149167
"yaml": "^1.7.2"
150168
}
151-
}
169+
}

src/api/api.ts

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function getClient(token: string): OctokitWithActions {
2828
params: {
2929
owner: { required: true, type: "string" },
3030
repo: { required: true, type: "string" },
31-
run: { required: true, type: "integer" },
31+
run: { required: true, type: "integer" }
3232
},
3333
headers: {
3434
accept: "application/vnd.github.jane-hopper-preview+json"
@@ -41,12 +41,49 @@ export function getClient(token: string): OctokitWithActions {
4141
params: {
4242
owner: { required: true, type: "string" },
4343
repo: { required: true, type: "string" },
44-
run: { required: true, type: "integer" },
44+
run: { required: true, type: "integer" }
4545
},
4646
headers: {
4747
accept: "application/vnd.github.jane-hopper-preview+json"
4848
},
4949
url: "/repos/:owner/:repo/actions/runs/:run/rerun"
50+
},
51+
52+
getSecrets: {
53+
method: "GET",
54+
params: {
55+
owner: { required: true, type: "string" },
56+
repo: { required: true, type: "string" }
57+
},
58+
headers: {
59+
accept: "application/vnd.github.jane-hopper-preview+json"
60+
},
61+
url: "/repos/:owner/:repo/actions/secrets"
62+
},
63+
64+
setSecret: {
65+
method: "PUT",
66+
params: {
67+
owner: { required: true, type: "string" },
68+
repo: { required: true, type: "string" },
69+
name: { require: true, type: "string" }
70+
},
71+
headers: {
72+
accept: "application/vnd.github.jane-hopper-preview+json"
73+
},
74+
url: "/repos/:owner/:repo/actions/secrets/:name"
75+
},
76+
77+
getPublicKey: {
78+
method: "GET",
79+
params: {
80+
owner: { required: true, type: "string" },
81+
repo: { required: true, type: "string" }
82+
},
83+
headers: {
84+
accept: "application/vnd.github.jane-hopper-preview+json"
85+
},
86+
url: "/repos/:owner/:repo/actions/secrets/public-key"
5087
}
5188
}
5289
});

0 commit comments

Comments
 (0)