Skip to content

Commit 7b34584

Browse files
committed
docs: updated to latest OpenAPI spec
1 parent 8c17a27 commit 7b34584

File tree

95 files changed

+808
-211
lines changed

Some content is hidden

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

95 files changed

+808
-211
lines changed

docs/actions/createOrUpdateOrgSecret.md

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,81 @@ type: API method
88

99
# Create or update an organization secret
1010

11-
Creates or updates an organization secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
11+
Creates or updates an organization 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 `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to
14+
use this endpoint.
15+
16+
#### Example encrypting a secret using Node.js
1217

1318
Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.
1419

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+
1541
Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3.
1642

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+
1757
Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.
1858

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+
1970
Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.
2071

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+
2186
```js
2287
octokit.actions.createOrUpdateOrgSecret({
2388
org,
@@ -54,9 +119,9 @@ ID of the key you used to encrypt the secret.
54119
</td></tr>
55120
<tr><td>visibility</td><td>no</td><td>
56121

57-
Configures the access that repositories have to the organization secret. Can be one of:
58-
\- `all` - All repositories in an organization can access the secret.
59-
\- `private` - Private repositories in an organization can access the secret.
122+
Configures the access that repositories have to the organization secret. Can be one of:
123+
\- `all` - All repositories in an organization can access the secret.
124+
\- `private` - Private repositories in an organization can access the secret.
60125
\- `selected` - Only specific repositories can access the secret.
61126

62127
</td></tr>

docs/actions/createOrUpdateRepoSecret.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,81 @@ type: API method
88

99
# Create or update a repository secret
1010

11-
Creates or updates a repository secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). 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.
11+
Creates or updates a repository 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
1217

1318
Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.
1419

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+
1541
Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3.
1642

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+
1757
Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.
1858

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+
1970
Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.
2071

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+
2186
```js
2287
octokit.actions.createOrUpdateRepoSecret({
2388
owner,

docs/actions/createRegistrationTokenForOrg.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ type: API method
1010

1111
**Warning:** The self-hosted runners API for organizations is currently in public beta and subject to change.
1212

13-
Returns a token that you can pass to the `config` script. The token expires after one hour. You must authenticate using an access token with the `admin:org` scope to use this endpoint.
13+
Returns a token that you can pass to the `config` script. The token expires after one hour. You must authenticate
14+
using an access token with the `admin:org` scope to use this endpoint.
15+
16+
#### Example using registration token
1417

1518
Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
1619

20+
```
21+
./config.sh --url https://github.com/octo-org --token TOKEN
22+
```
23+
1724
```js
1825
octokit.actions.createRegistrationTokenForOrg({
1926
org,

docs/actions/createRegistrationTokenForRepo.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ type: API method
88

99
# Create a registration token for a repository
1010

11-
Returns a token that you can pass to the `config` script. The token expires after one hour. You must authenticate using an access token with the `repo` scope to use this endpoint.
11+
Returns a token that you can pass to the `config` script. The token expires after one hour. You must authenticate
12+
using an access token with the `repo` scope to use this endpoint.
1213

13-
Configure your self-hosted runner, replacing TOKEN with the registration token provided by this endpoint.
14+
#### Example using registration token
15+
16+
Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
17+
18+
```
19+
./config.sh --url https://github.com/octo-org/octo-repo-artifacts --token TOKEN
20+
```
1421

1522
```js
1623
octokit.actions.createRegistrationTokenForRepo({

docs/actions/createRemoveTokenForOrg.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ type: API method
1010

1111
**Warning:** The self-hosted runners API for organizations is currently in public beta and subject to change.
1212

13-
Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour. You must authenticate using an access token with the `admin:org` scope to use this endpoint.
13+
Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The
14+
token expires after one hour. You must authenticate using an access token with the `admin:org` scope to use this
15+
endpoint.
1416

15-
To remove your self-hosted runner from an organization, replace `TOKEN` with the remove token provided by this endpoint.
17+
#### Example using remove token
18+
19+
To remove your self-hosted runner from an organization, replace `TOKEN` with the remove token provided by this
20+
endpoint.
21+
22+
```
23+
./config.sh remove --token TOKEN
24+
```
1625

1726
```js
1827
octokit.actions.createRemoveTokenForOrg({

docs/actions/createRemoveTokenForRepo.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ type: API method
88

99
# Create a remove token for a repository
1010

11-
Returns a token that you can pass to remove a self-hosted runner from a repository. The token expires after one hour. You must authenticate using an access token with the `repo` scope to use this endpoint.
11+
Returns a token that you can pass to remove a self-hosted runner from a repository. The token expires after one hour.
12+
You must authenticate using an access token with the `repo` scope to use this endpoint.
1213

13-
Remove your self-hosted runner from a repository, replacing TOKEN with the remove token provided by this endpoint.
14+
#### Example using remove token
15+
16+
To remove your self-hosted runner from a repository, replace TOKEN with the remove token provided by this endpoint.
17+
18+
```
19+
./config.sh remove --token TOKEN
20+
```
1421

1522
```js
1623
octokit.actions.createRemoveTokenForRepo({
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: Create a workflow dispatch event
3+
example: octokit.actions.createWorkflowDispatch({ owner, repo, workflow_id, ref })
4+
route: POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches
5+
scope: actions
6+
type: API method
7+
---
8+
9+
# Create a workflow dispatch event
10+
11+
You can use this endpoint to manually trigger a GitHub Actions workflow run. You can also replace `{workflow_id}` with the workflow file name. For example, you could use `main.yml`.
12+
13+
You must configure your GitHub Actions workflow to run when the [`workflow_dispatch` webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The `inputs` are configured in the workflow file. For more information about how to configure the `workflow_dispatch` event in the workflow file, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)."
14+
15+
You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)."
16+
17+
```js
18+
octokit.actions.createWorkflowDispatch({
19+
owner,
20+
repo,
21+
workflow_id,
22+
ref,
23+
});
24+
```
25+
26+
## Parameters
27+
28+
<table>
29+
<thead>
30+
<tr>
31+
<th>name</th>
32+
<th>required</th>
33+
<th>description</th>
34+
</tr>
35+
</thead>
36+
<tbody>
37+
<tr><td>owner</td><td>yes</td><td>
38+
39+
</td></tr>
40+
<tr><td>repo</td><td>yes</td><td>
41+
42+
</td></tr>
43+
<tr><td>workflow_id</td><td>yes</td><td>
44+
45+
</td></tr>
46+
<tr><td>ref</td><td>yes</td><td>
47+
48+
The reference of the workflow run. The reference can be a branch, tag, or a commit SHA.
49+
50+
</td></tr>
51+
<tr><td>inputs</td><td>no</td><td>
52+
53+
Input keys and values configured in the workflow file. The maximum number of properties is 10.
54+
55+
</td></tr>
56+
<tr><td>inputs.*</td><td>no</td><td>
57+
58+
</td></tr>
59+
</tbody>
60+
</table>
61+
62+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/actions/workflows/#create-a-workflow-dispatch-event).

docs/actions/deleteWorkflowRun.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: Delete a workflow run
3+
example: octokit.actions.deleteWorkflowRun({ owner, repo, run_id })
4+
route: DELETE /repos/{owner}/{repo}/actions/runs/{run_id}
5+
scope: actions
6+
type: API method
7+
---
8+
9+
# Delete a workflow run
10+
11+
Delete a specific workflow run. Anyone with write access to the repository can use this endpoint. If the repository is
12+
private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:write` permission to use
13+
this endpoint.
14+
15+
```js
16+
octokit.actions.deleteWorkflowRun({
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+
</td></tr>
43+
</tbody>
44+
</table>
45+
46+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/actions/workflow-runs/#delete-a-workflow-run).

docs/actions/downloadArtifact.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ type: API method
88

99
# Download an artifact
1010

11-
Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for `Location:` in the response header to find the URL for the download. The `:archive_format` must be `zip`. 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.
12-
13-
Call this endpoint using the `-v` flag, which enables verbose output and allows you to see the download URL in the header. To download the file into the current working directory, specify the filename using the `-o` flag.
11+
Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for `Location:` in
12+
the response header to find the URL for the download. The `:archive_format` must be `zip`. Anyone with read access to
13+
the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope.
14+
GitHub Apps must have the `actions:read` permission to use this endpoint.
1415

1516
```js
1617
octokit.actions.downloadArtifact({

docs/actions/downloadJobLogsForWorkflowRun.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ type: API method
88

99
# Download job logs for a workflow run
1010

11-
Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for `Location:` in the response header to find the URL for the download. 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.
12-
13-
Call this endpoint using the `-v` flag, which enables verbose output and allows you to see the download URL in the header. To download the file into the current working directory, specify the filename using the `-o` flag.
11+
Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look
12+
for `Location:` in the response header to find the URL for the download. Anyone with read access to the repository can
13+
use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must
14+
have the `actions:read` permission to use this endpoint.
1415

1516
```js
1617
octokit.actions.downloadJobLogsForWorkflowRun({

0 commit comments

Comments
 (0)