Skip to content

Commit 954b096

Browse files
authored
feat: octokit.apps.scopeToken() (#316)
1 parent c0142b9 commit 954b096

19 files changed

+846
-100
lines changed

docs/actions/setAllowedActionsOrganization.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Set allowed actions for an organization
3-
example: octokit.actions.setAllowedActionsOrganization({ org })
3+
example: octokit.actions.setAllowedActionsOrganization({ org, github_owned_allowed, verified_allowed, patterns_allowed })
44
route: PUT /orgs/{org}/actions/permissions/selected-actions
55
scope: actions
66
type: API method
@@ -19,6 +19,9 @@ You must authenticate using an access token with the `admin:org` scope to use th
1919
```js
2020
octokit.actions.setAllowedActionsOrganization({
2121
org,
22+
github_owned_allowed,
23+
verified_allowed,
24+
patterns_allowed,
2225
});
2326
```
2427

@@ -36,17 +39,17 @@ octokit.actions.setAllowedActionsOrganization({
3639
<tr><td>org</td><td>yes</td><td>
3740

3841
</td></tr>
39-
<tr><td>github_owned_allowed</td><td>no</td><td>
42+
<tr><td>github_owned_allowed</td><td>yes</td><td>
4043

4144
Whether GitHub-owned actions are allowed. For example, this includes the actions in the `actions` organization.
4245

4346
</td></tr>
44-
<tr><td>verified_allowed</td><td>no</td><td>
47+
<tr><td>verified_allowed</td><td>yes</td><td>
4548

4649
Whether actions in GitHub Marketplace from verified creators are allowed. Set to `true` to allow all GitHub Marketplace actions by verified creators.
4750

4851
</td></tr>
49-
<tr><td>patterns_allowed</td><td>no</td><td>
52+
<tr><td>patterns_allowed</td><td>yes</td><td>
5053

5154
Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, `monalisa/octocat@*`, `monalisa/octocat@v2`, `monalisa/*`."
5255

docs/actions/setAllowedActionsRepository.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Set allowed actions for a repository
3-
example: octokit.actions.setAllowedActionsRepository({ owner, repo })
3+
example: octokit.actions.setAllowedActionsRepository({ owner, repo, github_owned_allowed, verified_allowed, patterns_allowed })
44
route: PUT /repos/{owner}/{repo}/actions/permissions/selected-actions
55
scope: actions
66
type: API method
@@ -20,6 +20,9 @@ You must authenticate using an access token with the `repo` scope to use this en
2020
octokit.actions.setAllowedActionsRepository({
2121
owner,
2222
repo,
23+
github_owned_allowed,
24+
verified_allowed,
25+
patterns_allowed,
2326
});
2427
```
2528

@@ -40,17 +43,17 @@ octokit.actions.setAllowedActionsRepository({
4043
<tr><td>repo</td><td>yes</td><td>
4144

4245
</td></tr>
43-
<tr><td>github_owned_allowed</td><td>no</td><td>
46+
<tr><td>github_owned_allowed</td><td>yes</td><td>
4447

4548
Whether GitHub-owned actions are allowed. For example, this includes the actions in the `actions` organization.
4649

4750
</td></tr>
48-
<tr><td>verified_allowed</td><td>no</td><td>
51+
<tr><td>verified_allowed</td><td>yes</td><td>
4952

5053
Whether actions in GitHub Marketplace from verified creators are allowed. Set to `true` to allow all GitHub Marketplace actions by verified creators.
5154

5255
</td></tr>
53-
<tr><td>patterns_allowed</td><td>no</td><td>
56+
<tr><td>patterns_allowed</td><td>yes</td><td>
5457

5558
Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, `monalisa/octocat@*`, `monalisa/octocat@v2`, `monalisa/*`."
5659

docs/apps/addRepoToInstallation.md

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

1111
Add a single repository to an installation. The authenticated user must have admin access to the repository.
1212

13-
You must use a personal access token (which you can create via the [command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) or the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations#create-a-new-authorization) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to access this endpoint.
13+
You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint.
1414

1515
```js
1616
octokit.apps.addRepoToInstallation({

docs/apps/checkToken.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ octokit.apps.checkToken({
3030
<tbody>
3131
<tr><td>client_id</td><td>yes</td><td>
3232

33+
The client ID of your GitHub app.
34+
3335
</td></tr>
3436
<tr><td>access_token</td><td>yes</td><td>
3537

docs/apps/deleteAuthorization.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ octokit.apps.deleteAuthorization({
3030
<tbody>
3131
<tr><td>client_id</td><td>yes</td><td>
3232

33+
The client ID of your GitHub app.
34+
3335
</td></tr>
3436
<tr><td>access_token</td><td>no</td><td>
3537

docs/apps/deleteToken.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ octokit.apps.deleteToken({
2929
<tbody>
3030
<tr><td>client_id</td><td>yes</td><td>
3131

32+
The client ID of your GitHub app.
33+
3234
</td></tr>
3335
<tr><td>access_token</td><td>no</td><td>
3436

docs/apps/removeRepoFromInstallation.md

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

1111
Remove a single repository from an installation. The authenticated user must have admin access to the repository.
1212

13-
You must use a personal access token (which you can create via the [command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) or the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations#create-a-new-authorization) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to access this endpoint.
13+
You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint.
1414

1515
```js
1616
octokit.apps.removeRepoFromInstallation({

docs/apps/resetToken.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ octokit.apps.resetToken({
3030
<tbody>
3131
<tr><td>client_id</td><td>yes</td><td>
3232

33+
The client ID of your GitHub app.
34+
3335
</td></tr>
3436
<tr><td>access_token</td><td>yes</td><td>
3537

docs/apps/scopeToken.md

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
---
2+
name: Create a scoped access token
3+
example: octokit.apps.scopeToken({ client_id })
4+
route: POST /applications/{client_id}/token/scoped
5+
scope: apps
6+
type: API method
7+
---
8+
9+
# Create a scoped access token
10+
11+
Exchanges a non-repository scoped user-to-server OAuth access token for a repository scoped user-to-server OAuth access token. You can specify which repositories the token can access and which permissions are granted to the token. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
12+
13+
```js
14+
octokit.apps.scopeToken({
15+
client_id,
16+
});
17+
```
18+
19+
## Parameters
20+
21+
<table>
22+
<thead>
23+
<tr>
24+
<th>name</th>
25+
<th>required</th>
26+
<th>description</th>
27+
</tr>
28+
</thead>
29+
<tbody>
30+
<tr><td>client_id</td><td>yes</td><td>
31+
32+
The client ID of your GitHub app.
33+
34+
</td></tr>
35+
<tr><td>access_token</td><td>no</td><td>
36+
37+
**Required.** The OAuth access token used to authenticate to the GitHub API.
38+
39+
</td></tr>
40+
<tr><td>target</td><td>no</td><td>
41+
42+
The name of the user or organization to scope the user-to-server access token to. **Required** unless `target_id` is specified.
43+
44+
</td></tr>
45+
<tr><td>target_id</td><td>no</td><td>
46+
47+
The ID of the user or organization to scope the user-to-server access token to. **Required** unless `target` is specified.
48+
49+
</td></tr>
50+
<tr><td>repositories</td><td>no</td><td>
51+
52+
The list of repository IDs to scope the user-to-server access token to. `repositories` may not be specified if `repository_ids` is specified.
53+
54+
</td></tr>
55+
<tr><td>repository_ids</td><td>no</td><td>
56+
57+
The list of repository names to scope the user-to-server access token to. `repository_ids` may not be specified if `repositories` is specified.
58+
59+
</td></tr>
60+
<tr><td>permissions</td><td>no</td><td>
61+
62+
The permissions granted to the user-to-server access token.
63+
64+
</td></tr>
65+
<tr><td>permissions.actions</td><td>no</td><td>
66+
67+
The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: `read` or `write`.
68+
69+
</td></tr>
70+
<tr><td>permissions.administration</td><td>no</td><td>
71+
72+
The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be one of: `read` or `write`.
73+
74+
</td></tr>
75+
<tr><td>permissions.checks</td><td>no</td><td>
76+
77+
The level of permission to grant the access token for checks on code. Can be one of: `read` or `write`.
78+
79+
</td></tr>
80+
<tr><td>permissions.content_references</td><td>no</td><td>
81+
82+
The level of permission to grant the access token for notification of content references and creation content attachments. Can be one of: `read` or `write`.
83+
84+
</td></tr>
85+
<tr><td>permissions.contents</td><td>no</td><td>
86+
87+
The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. Can be one of: `read` or `write`.
88+
89+
</td></tr>
90+
<tr><td>permissions.deployments</td><td>no</td><td>
91+
92+
The level of permission to grant the access token for deployments and deployment statuses. Can be one of: `read` or `write`.
93+
94+
</td></tr>
95+
<tr><td>permissions.environments</td><td>no</td><td>
96+
97+
The level of permission to grant the access token for managing repository environments. Can be one of: `read` or `write`.
98+
99+
</td></tr>
100+
<tr><td>permissions.issues</td><td>no</td><td>
101+
102+
The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be one of: `read` or `write`.
103+
104+
</td></tr>
105+
<tr><td>permissions.metadata</td><td>no</td><td>
106+
107+
The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be one of: `read` or `write`.
108+
109+
</td></tr>
110+
<tr><td>permissions.packages</td><td>no</td><td>
111+
112+
The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: `read` or `write`.
113+
114+
</td></tr>
115+
<tr><td>permissions.pages</td><td>no</td><td>
116+
117+
The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. Can be one of: `read` or `write`.
118+
119+
</td></tr>
120+
<tr><td>permissions.pull_requests</td><td>no</td><td>
121+
122+
The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. Can be one of: `read` or `write`.
123+
124+
</td></tr>
125+
<tr><td>permissions.repository_hooks</td><td>no</td><td>
126+
127+
The level of permission to grant the access token to manage the post-receive hooks for a repository. Can be one of: `read` or `write`.
128+
129+
</td></tr>
130+
<tr><td>permissions.repository_projects</td><td>no</td><td>
131+
132+
The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: `read`, `write`, or `admin`.
133+
134+
</td></tr>
135+
<tr><td>permissions.secret_scanning_alerts</td><td>no</td><td>
136+
137+
The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: `read` or `write`.
138+
139+
</td></tr>
140+
<tr><td>permissions.secrets</td><td>no</td><td>
141+
142+
The level of permission to grant the access token to manage repository secrets. Can be one of: `read` or `write`.
143+
144+
</td></tr>
145+
<tr><td>permissions.security_events</td><td>no</td><td>
146+
147+
The level of permission to grant the access token to view and manage security events like code scanning alerts. Can be one of: `read` or `write`.
148+
149+
</td></tr>
150+
<tr><td>permissions.single_file</td><td>no</td><td>
151+
152+
The level of permission to grant the access token to manage just a single file. Can be one of: `read` or `write`.
153+
154+
</td></tr>
155+
<tr><td>permissions.statuses</td><td>no</td><td>
156+
157+
The level of permission to grant the access token for commit statuses. Can be one of: `read` or `write`.
158+
159+
</td></tr>
160+
<tr><td>permissions.vulnerability_alerts</td><td>no</td><td>
161+
162+
The level of permission to grant the access token to retrieve Dependabot alerts. Can be one of: `read`.
163+
164+
</td></tr>
165+
<tr><td>permissions.workflows</td><td>no</td><td>
166+
167+
The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: `write`.
168+
169+
</td></tr>
170+
<tr><td>permissions.members</td><td>no</td><td>
171+
172+
The level of permission to grant the access token for organization teams and members. Can be one of: `read` or `write`.
173+
174+
</td></tr>
175+
<tr><td>permissions.organization_administration</td><td>no</td><td>
176+
177+
The level of permission to grant the access token to manage access to an organization. Can be one of: `read` or `write`.
178+
179+
</td></tr>
180+
<tr><td>permissions.organization_hooks</td><td>no</td><td>
181+
182+
The level of permission to grant the access token to manage the post-receive hooks for an organization. Can be one of: `read` or `write`.
183+
184+
</td></tr>
185+
<tr><td>permissions.organization_plan</td><td>no</td><td>
186+
187+
The level of permission to grant the access token for viewing an organization's plan. Can be one of: `read`.
188+
189+
</td></tr>
190+
<tr><td>permissions.organization_projects</td><td>no</td><td>
191+
192+
The level of permission to grant the access token to manage organization projects, columns, and cards. Can be one of: `read`, `write`, or `admin`.
193+
194+
</td></tr>
195+
<tr><td>permissions.organization_secrets</td><td>no</td><td>
196+
197+
The level of permission to grant the access token to manage organization secrets. Can be one of: `read` or `write`.
198+
199+
</td></tr>
200+
<tr><td>permissions.organization_self_hosted_runners</td><td>no</td><td>
201+
202+
The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. Can be one of: `read` or `write`.
203+
204+
</td></tr>
205+
<tr><td>permissions.organization_user_blocking</td><td>no</td><td>
206+
207+
The level of permission to grant the access token to view and manage users blocked by the organization. Can be one of: `read` or `write`.
208+
209+
</td></tr>
210+
<tr><td>permissions.team_discussions</td><td>no</td><td>
211+
212+
The level of permission to grant the access token to manage team discussions and related comments. Can be one of: `read` or `write`.
213+
214+
</td></tr>
215+
</tbody>
216+
</table>
217+
218+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/apps#create-a-scoped-access-token).

docs/enterpriseAdmin/setAllowedActionsEnterprise.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Set allowed actions for an enterprise
3-
example: octokit.enterpriseAdmin.setAllowedActionsEnterprise({ enterprise })
3+
example: octokit.enterpriseAdmin.setAllowedActionsEnterprise({ enterprise, github_owned_allowed, verified_allowed, patterns_allowed })
44
route: PUT /enterprises/{enterprise}/actions/permissions/selected-actions
55
scope: enterpriseAdmin
66
type: API method
@@ -15,6 +15,9 @@ You must authenticate using an access token with the `admin:enterprise` scope to
1515
```js
1616
octokit.enterpriseAdmin.setAllowedActionsEnterprise({
1717
enterprise,
18+
github_owned_allowed,
19+
verified_allowed,
20+
patterns_allowed,
1821
});
1922
```
2023

@@ -34,17 +37,17 @@ octokit.enterpriseAdmin.setAllowedActionsEnterprise({
3437
The slug version of the enterprise name. You can also substitute this value with the enterprise id.
3538

3639
</td></tr>
37-
<tr><td>github_owned_allowed</td><td>no</td><td>
40+
<tr><td>github_owned_allowed</td><td>yes</td><td>
3841

3942
Whether GitHub-owned actions are allowed. For example, this includes the actions in the `actions` organization.
4043

4144
</td></tr>
42-
<tr><td>verified_allowed</td><td>no</td><td>
45+
<tr><td>verified_allowed</td><td>yes</td><td>
4346

4447
Whether actions in GitHub Marketplace from verified creators are allowed. Set to `true` to allow all GitHub Marketplace actions by verified creators.
4548

4649
</td></tr>
47-
<tr><td>patterns_allowed</td><td>no</td><td>
50+
<tr><td>patterns_allowed</td><td>yes</td><td>
4851

4952
Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, `monalisa/octocat@*`, `monalisa/octocat@v2`, `monalisa/*`."
5053

0 commit comments

Comments
 (0)