Skip to content

Commit 5118fc8

Browse files
authored
feat: octokit.actions.createOrUpdateEnvironmentSecret(), octokit.actions.deleteEnvironmentSecret(), octokit.actions.getEnvironmentPublicKey(), octokit.actions.getEnvironmentSecret(), octokit.actions.getPendingDeploymentsForRun(), octokit.actions.getReviewsForRun(), octokit.actions.listEnvironmentSecrets(), octokit.actions.reviewPendingDeploymentsForRun(), octokit.repos.createAnEnvironment(), octokit.repos.deleteAnEnvironment(), octokit.repos.getAllEnvironments(), octokit.repos.getEnvironment(), octokit.repos.setEnvironmentProtectionRules() (#351)
1 parent 7b8c6c1 commit 5118fc8

File tree

182 files changed

+2656
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+2656
-510
lines changed

docs/actions/cancelWorkflowRun.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ octokit.actions.cancelWorkflowRun({
3737
</td></tr>
3838
<tr><td>run_id</td><td>yes</td><td>
3939

40+
The id of the workflow run
41+
4042
</td></tr>
4143
</tbody>
4244
</table>
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
name: Create or update an environment secret
3+
example: octokit.actions.createOrUpdateEnvironmentSecret({ repository_id, environment_name, secret_name })
4+
route: PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}
5+
scope: actions
6+
type: API method
7+
---
8+
9+
# Create or update an environment secret
10+
11+
Creates or updates an environment secret with an encrypted value. Encrypt your secret using
12+
[LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access
13+
token with the `repo` scope to use this endpoint. GitHub Apps must have the `secrets` repository permission to use
14+
this endpoint.
15+
16+
#### Example encrypting a secret using Node.js
17+
18+
Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.
19+
20+
```
21+
const sodium = require('tweetsodium');
22+
23+
const key = "base64-encoded-public-key";
24+
const value = "plain-text-secret";
25+
26+
// Convert the message and key to Uint8Array's (Buffer implements that interface)
27+
const messageBytes = Buffer.from(value);
28+
const keyBytes = Buffer.from(key, 'base64');
29+
30+
// Encrypt using LibSodium.
31+
const encryptedBytes = sodium.seal(messageBytes, keyBytes);
32+
33+
// Base64 the encrypted secret
34+
const encrypted = Buffer.from(encryptedBytes).toString('base64');
35+
36+
console.log(encrypted);
37+
```
38+
39+
#### Example encrypting a secret using Python
40+
41+
Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3.
42+
43+
```
44+
from base64 import b64encode
45+
from nacl import encoding, public
46+
47+
def encrypt(public_key: str, secret_value: str) -> str:
48+
"""Encrypt a Unicode string using the public key."""
49+
public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder())
50+
sealed_box = public.SealedBox(public_key)
51+
encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
52+
return b64encode(encrypted).decode("utf-8")
53+
```
54+
55+
#### Example encrypting a secret using C#
56+
57+
Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.
58+
59+
```
60+
var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret");
61+
var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=");
62+
63+
var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);
64+
65+
Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));
66+
```
67+
68+
#### Example encrypting a secret using Ruby
69+
70+
Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.
71+
72+
```ruby
73+
require "rbnacl"
74+
require "base64"
75+
76+
key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=")
77+
public_key = RbNaCl::PublicKey.new(key)
78+
79+
box = RbNaCl::Boxes::Sealed.from_public_key(public_key)
80+
encrypted_secret = box.encrypt("my_secret")
81+
82+
# Print the base64 encoded secret
83+
puts Base64.strict_encode64(encrypted_secret)
84+
```
85+
86+
```js
87+
octokit.actions.createOrUpdateEnvironmentSecret({
88+
repository_id,
89+
environment_name,
90+
secret_name,
91+
});
92+
```
93+
94+
## Parameters
95+
96+
<table>
97+
<thead>
98+
<tr>
99+
<th>name</th>
100+
<th>required</th>
101+
<th>description</th>
102+
</tr>
103+
</thead>
104+
<tbody>
105+
<tr><td>repository_id</td><td>yes</td><td>
106+
107+
</td></tr>
108+
<tr><td>environment_name</td><td>yes</td><td>
109+
110+
The name of the environment
111+
112+
</td></tr>
113+
<tr><td>secret_name</td><td>yes</td><td>
114+
115+
secret_name parameter
116+
117+
</td></tr>
118+
<tr><td>encrypted_value</td><td>no</td><td>
119+
120+
Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get an environment public key](https://docs.github.com/rest/reference/actions#get-an-environment-public-key) endpoint.
121+
122+
</td></tr>
123+
<tr><td>key_id</td><td>no</td><td>
124+
125+
ID of the key you used to encrypt the secret.
126+
127+
</td></tr>
128+
</tbody>
129+
</table>
130+
131+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/actions#create-or-update-an-environment-secret).
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Delete an environment secret
3+
example: octokit.actions.deleteEnvironmentSecret({ repository_id, environment_name, secret_name })
4+
route: DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}
5+
scope: actions
6+
type: API method
7+
---
8+
9+
# Delete an environment secret
10+
11+
Deletes a secret in an environment using the secret name. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `secrets` repository permission to use this endpoint.
12+
13+
```js
14+
octokit.actions.deleteEnvironmentSecret({
15+
repository_id,
16+
environment_name,
17+
secret_name,
18+
});
19+
```
20+
21+
## Parameters
22+
23+
<table>
24+
<thead>
25+
<tr>
26+
<th>name</th>
27+
<th>required</th>
28+
<th>description</th>
29+
</tr>
30+
</thead>
31+
<tbody>
32+
<tr><td>repository_id</td><td>yes</td><td>
33+
34+
</td></tr>
35+
<tr><td>environment_name</td><td>yes</td><td>
36+
37+
The name of the environment
38+
39+
</td></tr>
40+
<tr><td>secret_name</td><td>yes</td><td>
41+
42+
secret_name parameter
43+
44+
</td></tr>
45+
</tbody>
46+
</table>
47+
48+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/actions#delete-an-environment-secret).

docs/actions/deleteWorkflowRun.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ octokit.actions.deleteWorkflowRun({
3939
</td></tr>
4040
<tr><td>run_id</td><td>yes</td><td>
4141

42+
The id of the workflow run
43+
4244
</td></tr>
4345
</tbody>
4446
</table>

docs/actions/deleteWorkflowRunLogs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ octokit.actions.deleteWorkflowRunLogs({
3737
</td></tr>
3838
<tr><td>run_id</td><td>yes</td><td>
3939

40+
The id of the workflow run
41+
4042
</td></tr>
4143
</tbody>
4244
</table>

docs/actions/downloadWorkflowRunLogs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ octokit.actions.downloadWorkflowRunLogs({
4040
</td></tr>
4141
<tr><td>run_id</td><td>yes</td><td>
4242

43+
The id of the workflow run
44+
4345
</td></tr>
4446
</tbody>
4547
</table>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Get an environment public key
3+
example: octokit.actions.getEnvironmentPublicKey({ repository_id, environment_name })
4+
route: GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key
5+
scope: actions
6+
type: API method
7+
---
8+
9+
# Get an environment public key
10+
11+
Get the public key for an environment, which you need to encrypt environment secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `secrets` repository permission to use this endpoint.
12+
13+
```js
14+
octokit.actions.getEnvironmentPublicKey({
15+
repository_id,
16+
environment_name,
17+
});
18+
```
19+
20+
## Parameters
21+
22+
<table>
23+
<thead>
24+
<tr>
25+
<th>name</th>
26+
<th>required</th>
27+
<th>description</th>
28+
</tr>
29+
</thead>
30+
<tbody>
31+
<tr><td>repository_id</td><td>yes</td><td>
32+
33+
</td></tr>
34+
<tr><td>environment_name</td><td>yes</td><td>
35+
36+
The name of the environment
37+
38+
</td></tr>
39+
</tbody>
40+
</table>
41+
42+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/actions#get-an-environment-public-key).
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Get an environment secret
3+
example: octokit.actions.getEnvironmentSecret({ repository_id, environment_name, secret_name })
4+
route: GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}
5+
scope: actions
6+
type: API method
7+
---
8+
9+
# Get an environment secret
10+
11+
Gets a single environment secret without revealing its encrypted value. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `secrets` repository permission to use this endpoint.
12+
13+
```js
14+
octokit.actions.getEnvironmentSecret({
15+
repository_id,
16+
environment_name,
17+
secret_name,
18+
});
19+
```
20+
21+
## Parameters
22+
23+
<table>
24+
<thead>
25+
<tr>
26+
<th>name</th>
27+
<th>required</th>
28+
<th>description</th>
29+
</tr>
30+
</thead>
31+
<tbody>
32+
<tr><td>repository_id</td><td>yes</td><td>
33+
34+
</td></tr>
35+
<tr><td>environment_name</td><td>yes</td><td>
36+
37+
The name of the environment
38+
39+
</td></tr>
40+
<tr><td>secret_name</td><td>yes</td><td>
41+
42+
secret_name parameter
43+
44+
</td></tr>
45+
</tbody>
46+
</table>
47+
48+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/actions#get-an-environment-secret).
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Get pending deployments for a workflow run
3+
example: octokit.actions.getPendingDeploymentsForRun({ owner, repo, run_id })
4+
route: GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments
5+
scope: actions
6+
type: API method
7+
---
8+
9+
# Get pending deployments for a workflow run
10+
11+
Get all deployment environments for a workflow run that are waiting for protection rules to pass.
12+
13+
Anyone with read access to the repository can use this endpoint. If the repository is private, you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint.
14+
15+
```js
16+
octokit.actions.getPendingDeploymentsForRun({
17+
owner,
18+
repo,
19+
run_id,
20+
});
21+
```
22+
23+
## Parameters
24+
25+
<table>
26+
<thead>
27+
<tr>
28+
<th>name</th>
29+
<th>required</th>
30+
<th>description</th>
31+
</tr>
32+
</thead>
33+
<tbody>
34+
<tr><td>owner</td><td>yes</td><td>
35+
36+
</td></tr>
37+
<tr><td>repo</td><td>yes</td><td>
38+
39+
</td></tr>
40+
<tr><td>run_id</td><td>yes</td><td>
41+
42+
The id of the workflow run
43+
44+
</td></tr>
45+
</tbody>
46+
</table>
47+
48+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/actions#get-pending-deployments-for-a-workflow-run).

0 commit comments

Comments
 (0)